Skip to content
Permalink
84e7df6c30
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
25 lines (21 sloc) 600 Bytes
import { jsonError } from "../../../../common.js";
export async function onRequestPost(context: RequestContext) {
const { D1 } = context.env;
const { event } = context.data;
try {
await D1.batch([
D1.prepare("UPDATE events SET performed_at = 0 WHERE id = ?;").bind(
event.id,
),
D1.prepare(
"UPDATE et_members SET points = points - 5 WHERE id = ?;",
).bind(event.created_by),
]);
} catch (e) {
console.log(e);
return jsonError("Failed to complete batch transaction", 500);
}
return new Response(null, {
status: 204,
});
}