From 30d9eeed7f4bd87f7aeca5fd3a0287f64e674b03 Mon Sep 17 00:00:00 2001
From: Regalijan <r@regalijan.com>
Date: Fri, 13 Sep 2024 15:07:57 -0400
Subject: [PATCH] Create forgotten event endpoint

---
 functions/api/events-team/events/[id]/forgotten.ts | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 functions/api/events-team/events/[id]/forgotten.ts

diff --git a/functions/api/events-team/events/[id]/forgotten.ts b/functions/api/events-team/events/[id]/forgotten.ts
new file mode 100644
index 0000000..48adcda
--- /dev/null
+++ b/functions/api/events-team/events/[id]/forgotten.ts
@@ -0,0 +1,13 @@
+export async function onRequestPost(context: RequestContext) {
+  const id = context.params.id as string;
+
+  await context.env.D1.prepare(
+    "UPDATE events SET performed_at = 0 WHERE id = ?;",
+  )
+    .bind(id)
+    .run();
+
+  return new Response(null, {
+    status: 204,
+  });
+}