diff --git a/backend/src/routes/overseer.ts b/backend/src/routes/overseer.ts index 82ce998..f14f01c 100644 --- a/backend/src/routes/overseer.ts +++ b/backend/src/routes/overseer.ts @@ -139,14 +139,12 @@ router.post( req.body.id ?? req.body.overseer_request_id; const statusRaw = String(req.body.status || "").toUpperCase(); - const status = - statusRaw === "APPROVED" || statusRaw === "COMPLETED" - ? "APPROVED" - : statusRaw === "DECLINED" || statusRaw === "FAILED" - ? "DECLINED" - : statusRaw; - if (!rawId || !status) - return res.status(400).json({ error: "Missing fields" }); + let status = "PENDING"; + if (statusRaw === "APPROVED" || statusRaw === "COMPLETED") + status = "APPROVED"; + else if (statusRaw === "DECLINED" || statusRaw === "FAILED") + status = "DECLINED"; + if (!rawId) return res.status(400).json({ error: "Missing fields" }); const request = await prisma.contentRequest.findFirst({ where: { overseerRequestId: Number(rawId) }, include: { user: true }, @@ -154,7 +152,7 @@ router.post( if (!request) return res.status(404).json({ error: "Request not found" }); const updatedRequest = await prisma.contentRequest.update({ where: { id: request.id }, - data: { status }, + data: { status: status as any }, }); if (status === "DECLINED") { await prisma.transaction.create({