diff --git a/functions/api/events-team/events/new.ts b/functions/api/events-team/events/new.ts index a0b4366..97047ec 100644 --- a/functions/api/events-team/events/new.ts +++ b/functions/api/events-team/events/new.ts @@ -62,9 +62,10 @@ export async function onRequestPost(context: RequestContext) { const id = `${now.getTime()}${crypto.randomUUID().replaceAll("-", "")}`; await context.env.D1.prepare( - "INSERT INTO events (created_at, created_by, day, id, month, type, year) VALUES (?, ?, ?, ?, ?, ?, ?);", + "INSERT INTO events (answer, created_at, created_by, day, id, month, type, year) VALUES (?, ?, ?, ?, ?, ?, ?);", ) .bind( + context.data.body.answer || null, now.getTime(), context.data.current_user.id, day, @@ -75,23 +76,6 @@ export async function onRequestPost(context: RequestContext) { ) .run(); - await context.env.DATA.put( - `event_${id}`, - JSON.stringify({ - answer: context.data.body.answer, - created_at: now.getTime(), - created_by: context.data.current_user.id, - day, - details, - month: currentMonth, - pending: true, - year: currentYear, - }), - { - expirationTtl: 15552000, - }, - ); - return new Response(null, { status: 204, });