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.

make programId required in partners/analytics

Steven Tey19a94b2c70de
diff --git a/apps/web/app/api/partners/analytics/route.ts b/apps/web/app/api/partners/analytics/route.ts
index 268fd51b52..27a7d2c01d 100644
--- a/apps/web/app/api/partners/analytics/route.ts
+++ b/apps/web/app/api/partners/analytics/route.ts
@@ -27,14 +27,6 @@ export const GET = withWorkspace(async ({ workspace, searchParams }) => {
timezone,
} = partnerAnalyticsQuerySchema.parse(searchParams);
- if (!programId) {
- throw new DubApiError({
- code: "bad_request",
- message:
- "Program ID not found. Did you forget to include a `programId` query parameter?",
- });
- }
-
if (!partnerId && !tenantId) {
throw new DubApiError({
code: "bad_request",
diff --git a/apps/web/lib/zod/schemas/partners.ts b/apps/web/lib/zod/schemas/partners.ts
index f175123bf4..682ecfbebd 100644
--- a/apps/web/lib/zod/schemas/partners.ts
+++ b/apps/web/lib/zod/schemas/partners.ts
@@ -289,7 +289,6 @@ export const upsertPartnerLinkSchema = createPartnerLinkSchema.merge(
// For /api/partners/analytics
export const partnerAnalyticsQuerySchema = analyticsQuerySchema
.pick({
- programId: true,
partnerId: true,
tenantId: true,
interval: true,
@@ -305,6 +304,9 @@ export const partnerAnalyticsQuerySchema = analyticsQuerySchema
.describe(
"The parameter to group the analytics data points by. Defaults to `count` if undefined.",
),
+ programId: z
+ .string()
+ .describe("The ID of the program to retrieve analytics for."),
}),
);