Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Disallow deleting events marked as complete or forgotten
  • Loading branch information
regalijan committed Nov 19, 2024
1 parent 82610a2 commit 6d357e4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions functions/api/events-team/events/[id].ts
Expand Up @@ -35,6 +35,12 @@ export async function onRequestDelete(context: RequestContext) {
403,
);

if (typeof eventData.performed_at !== "number")
return jsonError(
"Event cannot be deleted because it has already been marked as completed or forgotten",
400,
);

await context.env.D1.prepare("DELETE FROM events WHERE id = ?;")
.bind(eventId)
.run();
Expand Down

0 comments on commit 6d357e4

Please sign in to comment.