Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Add 1 to discount.maxDuration

Steven Tey197abbda294c
diff --git a/apps/web/lib/zod/schemas/misc.ts b/apps/web/lib/zod/schemas/misc.ts
index 7bc45871db..8de1e6aba3 100644
--- a/apps/web/lib/zod/schemas/misc.ts
+++ b/apps/web/lib/zod/schemas/misc.ts
@@ -3,7 +3,7 @@ import z from "@/lib/zod";
import { GOOGLE_FAVICON_URL, R2_URL } from "@dub/utils";
import { fileTypeFromBuffer } from "file-type";
-export const RECURRING_MAX_DURATIONS = [0, 3, 6, 12, 18, 24, 36];
+export const RECURRING_MAX_DURATIONS = [0, 1, 3, 6, 12, 18, 24, 36];
export const planSchema = z.enum(plans).describe("The plan of the workspace.");
diff --git a/apps/web/ui/partners/format-discount-description.ts b/apps/web/ui/partners/format-discount-description.ts
index 749496e74a..b1658fa4ba 100644
--- a/apps/web/ui/partners/format-discount-description.ts
+++ b/apps/web/ui/partners/format-discount-description.ts
@@ -22,7 +22,7 @@ export function formatDiscountDescription({
if (discount.maxDuration === null) {
parts.push("for the their lifetime");
} else if (discount.maxDuration === 0) {
- parts.push("for their first month");
+ parts.push("for their first purchase");
} else if (discount.maxDuration && discount.maxDuration > 0) {
parts.push(
`for ${discount.maxDuration} ${pluralize("month", discount.maxDuration)}`,
diff --git a/packages/prisma/schema/discount.prisma b/packages/prisma/schema/discount.prisma
index d4cab8f6a3..3857a5d7a7 100644
--- a/packages/prisma/schema/discount.prisma
+++ b/packages/prisma/schema/discount.prisma
@@ -3,7 +3,7 @@ model Discount {
programId String
amount Int @default(0)
type RewardStructure @default(percentage)
- maxDuration Int? // in months (0 -> not recurring, null -> lifetime)
+ maxDuration Int? // in months (0 -> one-time purchase, 1, 3, 6, 12, 18, 24, 36 -> months, null -> lifetime)
description String?
couponId String?
couponTestId String?