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,