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 `linkId` filtering

Tim Wilson58f833b55d81
diff --git a/apps/web/app/api/partner-profile/programs/[programId]/earnings/count/route.ts b/apps/web/app/api/partner-profile/programs/[programId]/earnings/count/route.ts
index 42640bf109..3e4cb05a47 100644
--- a/apps/web/app/api/partner-profile/programs/[programId]/earnings/count/route.ts
+++ b/apps/web/app/api/partner-profile/programs/[programId]/earnings/count/route.ts
@@ -13,7 +13,7 @@ export const GET = withPartnerProfile(
programId: params.programId,
});
- const { type, status, customerId, payoutId, interval, start, end } =
+ const { type, status, linkId, customerId, payoutId, interval, start, end } =
getPartnerSalesCountQuerySchema.parse(searchParams);
const { startDate, endDate } = getStartEndDates({
@@ -28,6 +28,7 @@ export const GET = withPartnerProfile(
partnerId: partner.id,
...(type && { type }),
...(status && { status }),
+ ...(linkId && { linkId }),
...(customerId && { customerId }),
...(payoutId && { payoutId }),
createdAt: {
diff --git a/apps/web/app/api/partner-profile/programs/[programId]/earnings/route.ts b/apps/web/app/api/partner-profile/programs/[programId]/earnings/route.ts
index 1f56b71307..c41d6e3473 100644
--- a/apps/web/app/api/partner-profile/programs/[programId]/earnings/route.ts
+++ b/apps/web/app/api/partner-profile/programs/[programId]/earnings/route.ts
@@ -24,6 +24,7 @@ export const GET = withPartnerProfile(
status,
sortBy,
sortOrder,
+ linkId,
customerId,
payoutId,
interval,
@@ -43,6 +44,7 @@ export const GET = withPartnerProfile(
partnerId: partner.id,
type,
status,
+ linkId,
customerId,
payoutId,
createdAt: {
diff --git a/apps/web/lib/zod/schemas/partners.ts b/apps/web/lib/zod/schemas/partners.ts
index 41d3756fd9..968bcef0a2 100644
--- a/apps/web/lib/zod/schemas/partners.ts
+++ b/apps/web/lib/zod/schemas/partners.ts
@@ -160,6 +160,7 @@ export const getPartnerSalesQuerySchema = getSalesQuerySchema
})
.extend({
type: z.enum(["click", "lead", "sale"]).optional(),
+ linkId: z.string().optional(),
sortBy: z.enum(["createdAt", "amount", "earnings"]).default("createdAt"),
});
@@ -202,6 +203,7 @@ export const getPartnerSalesCountQuerySchema = getSalesCountQuerySchema
})
.extend({
type: z.enum(["click", "lead", "sale"]).optional(),
+ linkId: z.string().optional(),
groupBy: z.enum(["customer"]).optional(),
});