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.

update createPartnerSchema

Steven Tey25c8fa55baa8
diff --git a/apps/web/lib/zod/schemas/partners.ts b/apps/web/lib/zod/schemas/partners.ts
index 7c2758ba40..7ed6df7c84 100644
--- a/apps/web/lib/zod/schemas/partners.ts
+++ b/apps/web/lib/zod/schemas/partners.ts
@@ -154,20 +154,49 @@ export const getPartnerSalesCountQuerySchema = getSalesCountQuerySchema.omit({
partnerId: true,
});
-export const onboardPartnerSchema = z.object({
- name: z.string().trim().min(1).max(100),
- email: z.string().trim().min(1).max(190).email(),
- image: z.string(),
- country: z.enum(COUNTRY_CODES),
- description: z.string().max(5000).nullable(),
+export const createPartnerSchema = z.object({
+ name: z
+ .string()
+ .trim()
+ .min(1)
+ .max(100)
+ .describe("Full legal name of the partner."),
+ email: z
+ .string()
+ .trim()
+ .min(1)
+ .max(190)
+ .email()
+ .describe(
+ "Email for the partner in your system. Partners will be able to claim their profile by signing up to Dub Partners with this email.",
+ ),
+ username: z
+ .string()
+ .min(1)
+ .max(100)
+ .describe(
+ "A unique username for the partner in your system. This will be used to create a short link for the partner using your program's default domain.",
+ ),
+ image: z
+ .string()
+ .nullish()
+ .describe(
+ "Avatar image for the partner – if not provided, a default avatar will be used.",
+ ),
+ country: z
+ .enum(COUNTRY_CODES)
+ .nullish()
+ .describe("Country where the partner is based."),
+ description: z
+ .string()
+ .max(5000)
+ .nullish()
+ .describe("A brief description of the partner and their background."),
});
-export const createPartnerSchema = onboardPartnerSchema
- .pick({
- name: true,
- email: true,
- image: true,
- })
- .extend({
- username: z.string().min(1).max(100),
- });
+export const onboardPartnerSchema = createPartnerSchema.merge(
+ z.object({
+ image: z.string(),
+ country: z.enum(COUNTRY_CODES),
+ }),
+);