Ensure action requested status readonly as well

This commit is contained in:
Dominic Ferrando
2026-09-19 18:03:41 -04:00
parent ae2ba4d317
commit 3c0233f087
2 changed files with 13 additions and 6 deletions
+4 -2
View File
@@ -565,7 +565,8 @@ export const app = new Elysia()
.post("/:id/request-action", async ({ params: { id }, body: { reviewerNotes, activityVerifications } }) => {
const verification = await s.Verifications.get(id);
if (!verification) throw new NotFoundError("Verification not found");
if (verification.status === "completed") throw status(409, { error: "Cannot modify a completed verification" });
if (verification.status === "completed" || verification.status === "action_requested")
throw status(409, { error: "Cannot modify a completed or action-requested verification" });
const updated = await s.Verifications.requestAction(id, reviewerNotes ?? null, activityVerifications);
if (!updated) throw new NotFoundError("Verification not found");
@@ -579,7 +580,8 @@ export const app = new Elysia()
.post("/:id/complete", async ({ params: { id }, body: { activityVerifications }, accountId }) => {
const verification = await s.Verifications.get(id);
if (!verification) throw new NotFoundError("Verification not found");
if (verification.status === "completed") throw status(409, { error: "Cannot modify a completed verification" });
if (verification.status === "completed" || verification.status === "action_requested")
throw status(409, { error: "Cannot modify a completed or action-requested verification" });
const updated = await s.Verifications.complete(id, accountId, activityVerifications);
if (!updated) throw new NotFoundError("Verification not found");