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.

Append partiallyApproved to the end of the enum and fix the conflict message

Rafi9e5bed20eba4
diff --git a/apps/web/lib/bounty/api/create-bounty-submission.ts b/apps/web/lib/bounty/api/create-bounty-submission.ts
index 096f1519ff..4832414481 100644
--- a/apps/web/lib/bounty/api/create-bounty-submission.ts
+++ b/apps/web/lib/bounty/api/create-bounty-submission.ts
@@ -269,9 +269,15 @@ export class BountySubmissionHandler {
existingSubmission.status !== "draft" ||
bountyInfo?.hasSocialMetrics
) {
+ // e.g. partiallyApproved -> partially approved
+ const status = existingSubmission.status.replace(
+ /[A-Z]/g,
+ (char) => ` ${char.toLowerCase()}`,
+ );
+
throw new DubApiError({
code: "conflict",
- message: `You already have a ${existingSubmission.status} submission for this period.`,
+ message: `You already have a submission for this period (status: ${status}).`,
});
}
}
diff --git a/apps/web/prisma/schema/bounty.prisma b/apps/web/prisma/schema/bounty.prisma
index bf7fd452d6..a4b89c3395 100644
--- a/apps/web/prisma/schema/bounty.prisma
+++ b/apps/web/prisma/schema/bounty.prisma
@@ -11,9 +11,9 @@ enum BountyPerformanceScope {
enum BountySubmissionStatus {
draft
submitted
- partiallyApproved
approved
rejected
+ partiallyApproved // appended last so the MySQL ENUM change is metadata only
}
enum BountySubmissionRejectionReason {