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.

Refactor earnings route to include customer details and update PartnerEarningsSchema to omit userId and invoiceId

Kiran Kdc257a9a90c0
diff --git a/apps/web/app/(ee)/api/embed/referrals/earnings/route.ts b/apps/web/app/(ee)/api/embed/referrals/earnings/route.ts
index 300f1b2133..bb7aaa0d7e 100644
--- a/apps/web/app/(ee)/api/embed/referrals/earnings/route.ts
+++ b/apps/web/app/(ee)/api/embed/referrals/earnings/route.ts
@@ -20,21 +20,11 @@ export const GET = withReferralsEmbedToken(
programId: programEnrollment.programId,
partnerId: programEnrollment.partnerId,
},
- select: {
- id: true,
- type: true,
- amount: true,
- quantity: true,
- earnings: true,
- currency: true,
- status: true,
- createdAt: true,
- updatedAt: true,
+ include: {
customer: {
select: {
id: true,
email: true,
- avatar: true,
},
},
link: {
diff --git a/apps/web/lib/zod/schemas/partner-profile.ts b/apps/web/lib/zod/schemas/partner-profile.ts
index 4bd3ae35f8..1cf81a1276 100644
--- a/apps/web/lib/zod/schemas/partner-profile.ts
+++ b/apps/web/lib/zod/schemas/partner-profile.ts
@@ -14,7 +14,10 @@ import { customerActivityResponseSchema } from "./customer-activity";
import { CustomerEnrichedSchema } from "./customers";
import { LinkSchema } from "./links";
-export const PartnerEarningsSchema = CommissionSchema.merge(
+export const PartnerEarningsSchema = CommissionSchema.omit({
+ userId: true,
+ invoiceId: true,
+}).merge(
z.object({
customer: z
.object({