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.

Enhance performance bounty validation

Kiran K2fca09af8b74
diff --git a/apps/web/app/(ee)/api/bounties/route.ts b/apps/web/app/(ee)/api/bounties/route.ts
index 0d97883f3e..9fbe4859b5 100644
--- a/apps/web/app/(ee)/api/bounties/route.ts
+++ b/apps/web/app/(ee)/api/bounties/route.ts
@@ -142,6 +142,13 @@ export const POST = withWorkspace(
}
}
+ if (typeof currentStatsOnly !== "boolean" && type === "performance") {
+ throw new DubApiError({
+ code: "bad_request",
+ message: "currentStatsOnly must be set for performance bounties.",
+ });
+ }
+
const partnerGroups = await throwIfInvalidGroupIds({
programId,
groupIds,
diff --git a/apps/web/lib/zod/schemas/bounties.ts b/apps/web/lib/zod/schemas/bounties.ts
index 715c9fec34..69e1c2cc19 100644
--- a/apps/web/lib/zod/schemas/bounties.ts
+++ b/apps/web/lib/zod/schemas/bounties.ts
@@ -58,7 +58,7 @@ export const createBountySchema = z.object({
submissionRequirements: submissionRequirementsSchema.nullish(),
groupIds: z.array(z.string()).nullable(),
performanceCondition: workflowConditionSchema.nullish(),
- currentStatsOnly: z.boolean().nullable(),
+ currentStatsOnly: z.boolean().nullish(),
});
export const updateBountySchema = createBountySchema