Create gamenight certification endpoint
This commit is contained in:
parent
b22f64eb17
commit
042f67ea7d
16
functions/api/events-team/events/[id]/certify.ts
Normal file
16
functions/api/events-team/events/[id]/certify.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { jsonError } from "../../../../common.js";
|
||||
|
||||
export async function onRequestPost(context: RequestContext) {
|
||||
if (context.data.event.reached_minimum_player_count)
|
||||
return jsonError("This event is already certified", 400);
|
||||
|
||||
await context.env.D1.prepare(
|
||||
"UPDATE events SET reached_minimum_player_count WHERE id = ?;",
|
||||
)
|
||||
.bind(context.data.event.id)
|
||||
.run();
|
||||
|
||||
return new Response(null, {
|
||||
status: 204,
|
||||
});
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user