From 508f5c6b985490bbf6fe275806d71e8c60d41503 Mon Sep 17 00:00:00 2001 From: Regalijan Date: Thu, 14 Mar 2024 14:20:41 -0400 Subject: [PATCH] Skip approval process for gamenights --- functions/api/events-team/events/new.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions/api/events-team/events/new.ts b/functions/api/events-team/events/new.ts index b7043d8..cb89dd5 100644 --- a/functions/api/events-team/events/new.ts +++ b/functions/api/events-team/events/new.ts @@ -62,16 +62,18 @@ export async function onRequestPost(context: RequestContext) { const id = `${now.getTime()}${crypto.randomUUID().replaceAll("-", "")}`; await context.env.D1.prepare( - "INSERT INTO events (answer, created_at, created_by, day, details, id, month, type, year) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);", + "INSERT INTO events (answer, approved, created_at, created_by, day, details, id, month, pending, type, year) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);", ) .bind( context.data.body.answer || null, now.getTime(), + Number(type === "gamenight"), context.data.current_user.id, day, details, id, currentMonth, + Number(type !== "gamenight"), type, currentYear, )