From dd7577c14ae049076d2813748f48942a188876be Mon Sep 17 00:00:00 2001 From: Regalijan Date: Mon, 2 Dec 2024 18:02:24 -0500 Subject: [PATCH] Fix event deleting --- functions/api/events-team/events/[id].ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/api/events-team/events/[id].ts b/functions/api/events-team/events/[id].ts index c89f237..f037b1b 100644 --- a/functions/api/events-team/events/[id].ts +++ b/functions/api/events-team/events/[id].ts @@ -7,7 +7,7 @@ export async function onRequestDelete(context: RequestContext) { [k: string]: number; } & { created_by: string }) | null = await context.env.D1.prepare( - "SELECT created_by, day, month, year FROM events WHERE id = ?;", + "SELECT created_by, day, month, performed_at, year FROM events WHERE id = ?;", ) .bind(eventId) .first(); @@ -35,7 +35,7 @@ export async function onRequestDelete(context: RequestContext) { 403, ); - if (typeof eventData.performed_at !== "number") + if (typeof eventData.performed_at === "number") return jsonError( "Event cannot be deleted because it has already been marked as completed or forgotten", 400,