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.

address coderabbit comments

Kiran K10b05b7bbf35
diff --git a/apps/web/app/(ee)/api/bounties/[bountyId]/submissions/route.ts b/apps/web/app/(ee)/api/bounties/[bountyId]/submissions/route.ts
index 7af5527762..3bf6a6a534 100644
--- a/apps/web/app/(ee)/api/bounties/[bountyId]/submissions/route.ts
+++ b/apps/web/app/(ee)/api/bounties/[bountyId]/submissions/route.ts
@@ -32,8 +32,10 @@ export const GET = withWorkspace(
});
}
+ const filters = getBountySubmissionsQuerySchema.parse(searchParams);
+
const bountySubmissions = await getBountySubmissions({
- ...getBountySubmissionsQuerySchema.parse(searchParams),
+ ...filters,
bountyId: bounty.id,
});
diff --git a/apps/web/lib/api/bounties/get-bounties-by-groups.ts b/apps/web/lib/api/bounties/get-bounties-by-groups.ts
index 5cc40193c0..c072bc3dcf 100644
--- a/apps/web/lib/api/bounties/get-bounties-by-groups.ts
+++ b/apps/web/lib/api/bounties/get-bounties-by-groups.ts
@@ -27,6 +27,7 @@ export async function getBountiesByGroups({
const bountiesByGroups: Record<string, Bounty[]> = {};
+ // Note: global bounties are not included here
for (const groupId of groupIds) {
bountiesByGroups[groupId] = bounties.filter((bounty) =>
bounty.groups.some((g) => g.groupId === groupId),
diff --git a/apps/web/lib/api/bounties/get-bounty-submissions.ts b/apps/web/lib/api/bounties/get-bounty-submissions.ts
index 9cef73685f..b0b3901224 100644
--- a/apps/web/lib/api/bounties/get-bounty-submissions.ts
+++ b/apps/web/lib/api/bounties/get-bounty-submissions.ts
@@ -31,7 +31,7 @@ export async function getBountySubmissions({
programEnrollment: true,
},
orderBy: {
- createdAt: sortOrder,
+ createdAt: sortOrder, // TODO: We need to fix the sorting
},
skip: (page - 1) * pageSize,
take: pageSize,
diff --git a/apps/web/lib/api/bounties/trigger-draft-bounty-submissions.ts b/apps/web/lib/api/bounties/trigger-draft-bounty-submissions.ts
index 38b0930a33..0db81e10a0 100644
--- a/apps/web/lib/api/bounties/trigger-draft-bounty-submissions.ts
+++ b/apps/web/lib/api/bounties/trigger-draft-bounty-submissions.ts
@@ -20,6 +20,7 @@ export async function triggerDraftBountySubmissionCreation({
partnerId: {
in: partnerIds,
},
+ programId,
},
select: {
partnerId: true,
diff --git a/apps/web/scripts/migrations/backfill-bounties.ts b/apps/web/scripts/migrations/backfill-bounties.ts
index 47a426af35..882d358928 100644
--- a/apps/web/scripts/migrations/backfill-bounties.ts
+++ b/apps/web/scripts/migrations/backfill-bounties.ts
@@ -1,7 +1,7 @@
-import "dotenv-flow/config";
import { qstash } from "@/lib/cron";
import { prisma } from "@dub/prisma";
import { APP_DOMAIN_WITH_NGROK } from "@dub/utils";
+import "dotenv-flow/config";
async function main() {
// Step 1: Set all existing performance bounties to all-time stats
@@ -22,15 +22,18 @@ async function main() {
// Step 2: Create the draft bounty submission for performance bounties
for (const bounty of bounties) {
- qstash.publishJSON({
+ const response = await qstash.publishJSON({
url: `${APP_DOMAIN_WITH_NGROK}/api/cron/bounties/create-draft-submissions`,
body: {
bountyId: bounty.id,
},
});
+ await new Promise((resolve) => setTimeout(resolve, 5000));
+
console.log(
`Enqueued /api/cron/bounties/create-draft-submissions for the bounty ${bounty.id}`,
+ response,
);
}
}