From 1a35cca6cf0bfa553e0861ff6aa20c9216f46b9c Mon Sep 17 00:00:00 2001 From: regalijan Date: Thu, 19 Oct 2023 16:51:15 -0400 Subject: [PATCH] Set approved field on appeal action --- functions/api/appeals/[id]/accept.ts | 2 +- functions/api/appeals/[id]/deny.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/api/appeals/[id]/accept.ts b/functions/api/appeals/[id]/accept.ts index 6b1df9e..a1553fa 100644 --- a/functions/api/appeals/[id]/accept.ts +++ b/functions/api/appeals/[id]/accept.ts @@ -20,7 +20,7 @@ export async function onRequestPost(context: RequestContext) { const { current_user: currentUser } = context.data; - await context.env.D1.prepare("UPDATE appeals SET open = 0 WHERE id = ?;") + await context.env.D1.prepare("UPDATE appeals SET approved = 1, open = 0 WHERE id = ?;") .bind(context.params.id) .run(); diff --git a/functions/api/appeals/[id]/deny.ts b/functions/api/appeals/[id]/deny.ts index b7f93c1..8dd7312 100644 --- a/functions/api/appeals/[id]/deny.ts +++ b/functions/api/appeals/[id]/deny.ts @@ -19,7 +19,7 @@ export async function onRequestPost(context: RequestContext) { return jsonError("Failed to deny appeal", 500); } - await context.env.D1.prepare("UPDATE appeals SET open = 0 WHERE id = ?;") + await context.env.D1.prepare("UPDATE appeals SET approved = 0, open = 0 WHERE id = ?;") .bind(context.params.id) .run();