fix : not allow to delete message while ticket closed

This commit is contained in:
2026-10-02 21:29:12 +07:00 Unverified
parent f5b432a496
commit ddd36ba4a6
3 changed files with 12 additions and 2 deletions
@@ -15,6 +15,7 @@ export async function DELETE(request: Request,
const { id, messageId } = await context.params;
if (!z.uuid().safeParse(messageId).success) throw new HttpError(404, "message-not-found");
const { ticket, user } = await authorizeTicket(id);
if (ticket.status !== "open") throw new HttpError(409, "ticket-closed");
await limitRequest("commission-message-delete", user.id, 30);
const imageObjectKey = await getDb().transaction(async (tx) => {
const [message] = await tx.delete(commissionMessages)