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 partners.ts

Kiran Kb8427313dd9d
diff --git a/apps/web/lib/zod/schemas/partners.ts b/apps/web/lib/zod/schemas/partners.ts
index 2cb2fd3d8e..5ffc343206 100644
--- a/apps/web/lib/zod/schemas/partners.ts
+++ b/apps/web/lib/zod/schemas/partners.ts
@@ -252,8 +252,7 @@ export const PartnerSchema = z
})
.merge(PartnerOnlinePresenceSchema);
-// Used externally by GET+POST /api/partners and partner.enrolled webhook
-export const EnrolledPartnerSchema = PartnerSchema.pick({
+export const EnrolledPartnerBasicSchema = PartnerSchema.pick({
id: true,
name: true,
email: true,
@@ -270,54 +269,53 @@ export const EnrolledPartnerSchema = PartnerSchema.pick({
stripeConnectId: true,
payoutsEnabledAt: true,
createdAt: true,
-})
- .merge(
- ProgramEnrollmentSchema.pick({
- status: true,
- programId: true,
- tenantId: true,
- links: true,
+}).merge(
+ ProgramEnrollmentSchema.pick({
+ status: true,
+ programId: true,
+ tenantId: true,
+ links: true,
+ }),
+);
+
+// Used externally by GET+POST /api/partners and partner.enrolled webhook
+export const EnrolledPartnerSchema = EnrolledPartnerBasicSchema.extend({
+ clicks: z
+ .number()
+ .default(0)
+ .describe("The total number of clicks on the partner's links."),
+ leads: z
+ .number()
+ .default(0)
+ .describe("The total number of leads generated by the partner's links."),
+ sales: z
+ .number()
+ .default(0)
+ .describe("The total number of sales generated by the partner's links."),
+ saleAmount: z
+ .number()
+ .default(0)
+ .describe(
+ "The total amount of sales (in cents) generated by the partner's links.",
+ ),
+ totalCommissions: z
+ .number()
+ .default(0)
+ .describe("The total commissions paid to the partner for their referrals."),
+ netRevenue: z
+ .number()
+ .default(0)
+ .describe("The total net revenue generated by the partner."),
+ earnings: z
+ .number()
+ .default(0)
+ .describe(
+ "DEPRECATED: The total earnings/commissions accrued by the partner's links.",
+ )
+ .openapi({
+ deprecated: true,
}),
- )
- .extend({
- clicks: z
- .number()
- .default(0)
- .describe("The total number of clicks on the partner's links."),
- leads: z
- .number()
- .default(0)
- .describe("The total number of leads generated by the partner's links."),
- sales: z
- .number()
- .default(0)
- .describe("The total number of sales generated by the partner's links."),
- saleAmount: z
- .number()
- .default(0)
- .describe(
- "The total amount of sales (in cents) generated by the partner's links.",
- ),
- totalCommissions: z
- .number()
- .default(0)
- .describe(
- "The total commissions paid to the partner for their referrals.",
- ),
- netRevenue: z
- .number()
- .default(0)
- .describe("The total net revenue generated by the partner."),
- earnings: z
- .number()
- .default(0)
- .describe(
- "DEPRECATED: The total earnings/commissions accrued by the partner's links.",
- )
- .openapi({
- deprecated: true,
- }),
- });
+});
// Used internally in the Dub dashboard for partners table
export const EnrolledPartnerSchemaExtended = EnrolledPartnerSchema.merge(