Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove duplicate performed column
  • Loading branch information
regalijan committed Mar 5, 2024
1 parent 48ffe80 commit ff61311
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions functions/api/events-team/events/[id].ts
Expand Up @@ -64,7 +64,7 @@ export async function onRequestPatch(context: RequestContext) {
export async function onRequestPost(context: RequestContext) {
const eventId = context.params.id as string;
const eventData = await context.env.D1.prepare(
"SELECT approved, performed FROM events WHERE id = ?;",
"SELECT approved, performed_at FROM events WHERE id = ?;",
)
.bind(eventId)
.first();
Expand All @@ -74,8 +74,10 @@ export async function onRequestPost(context: RequestContext) {
if (!eventData.approved)
return jsonError("Cannot perform unapproved event", 403);

await context.env.D1.prepare("UPDATE events SET performed = 1 WHERE id = ?;")
.bind(eventId)
await context.env.D1.prepare(
"UPDATE events SET performed_at = ? WHERE id = ?;",
)
.bind(Date.now(), eventId)
.run();

return new Response(null, {
Expand Down

0 comments on commit ff61311

Please sign in to comment.