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.

Fix social metrics bounty flow - no draft state (#3728)

Kiran K14b7bbdb55a7
diff --git a/apps/web/lib/bounty/api/create-bounty-submission.ts b/apps/web/lib/bounty/api/create-bounty-submission.ts
index 94cf3b3ace..fb0425ec5c 100644
--- a/apps/web/lib/bounty/api/create-bounty-submission.ts
+++ b/apps/web/lib/bounty/api/create-bounty-submission.ts
@@ -519,9 +519,10 @@ export class BountySubmissionHandler {
});
}
+ // Note: We don't allow draft submission for social metrics bounties.
this.submissionData = {
...this.submissionData,
- status: "draft",
+ status: "submitted",
completedAt: null,
};
diff --git a/apps/web/scripts/misc/mark-bounties-submitted.ts b/apps/web/scripts/misc/mark-bounties-submitted.ts
new file mode 100644
index 0000000000..d03f22ef0b
--- /dev/null
+++ b/apps/web/scripts/misc/mark-bounties-submitted.ts
@@ -0,0 +1,40 @@
+import { prisma } from "@dub/prisma";
+import "dotenv-flow/config";
+
+async function main() {
+ const bountySubmissions = await prisma.bountySubmission.findMany({
+ where: {
+ status: "draft",
+ socialMetricCount: {
+ not: null,
+ },
+ },
+ select: {
+ id: true,
+ status: true,
+ socialMetricCount: true,
+ },
+ });
+
+ console.log(
+ `Found ${bountySubmissions.length} bounty submissions to mark as submitted.`,
+ );
+
+ console.table(bountySubmissions);
+
+ const { count } = await prisma.bountySubmission.updateMany({
+ where: {
+ id: {
+ in: bountySubmissions.map(({ id }) => id),
+ },
+ status: "draft",
+ },
+ data: {
+ status: "submitted",
+ },
+ });
+
+ console.log(`Marked ${count} bounty submissions as submitted.`);
+}
+
+main();