Files
car-crushers-portal/functions/api/events-team/points/[id].ts
Regalijan cfc57c838e
All checks were successful
Test, Build, Deploy / Test, Build, and Deploy (push) Successful in 55s
Test, Build, Deploy / Create Sentry Release (push) Successful in 6s
More events team nonsense
2026-04-11 03:30:46 -04:00

28 lines
664 B
TypeScript

import { jsonError } from "../../../common.js";
export async function onRequestPost(context: RequestContext) {
const { current_user: user } = context.data;
if (!user) return jsonError("You are not logged in", 401);
if (![1 << 4, 1 << 12].find((p) => user.permissions & p))
return jsonError("No permission to edit points", 403);
const { points } = context.data.body;
if (typeof points !== "number") return jsonError("Invalid point count", 400);
await context.data.prisma.etMember.update({
data: {
points,
},
where: {
id: context.params.id as string,
},
});
return new Response(null, {
status: 204,
});
}