Files
car-crushers-portal/functions/api/game-appeals/[id]/deny.ts
Regalijan 06fdfe9d10
All checks were successful
Test, Build, Deploy / Test, Build, and Deploy (push) Successful in 1m8s
Test, Build, Deploy / Create Sentry Release (push) Successful in 7s
Log appeal denials
2026-04-14 22:09:43 -04:00

46 lines
1.1 KiB
TypeScript

import { jsonError } from "../../../common.js";
import { getBanList } from "../../../roblox-open-cloud.js";
export async function onRequestPost(context: RequestContext) {
const appealId = context.params.id as string;
const appeal = await context.data.prisma.gameAppeal.findUnique({
select: {
roblox_id: true,
type: true,
},
where: {
id: appealId,
},
});
if (!appeal) return jsonError("Appeal not found", 404);
await context.data.prisma.gameAppeal.delete({
where: {
id: appealId,
},
});
const { value: banList } = await getBanList(context);
await context.data.prisma.gameModLog.create({
data: {
action: `deny appeal | ${banList[appeal.roblox_id]?.BanType === 2 ? "ban" : appeal.type}`,
evidence: `https://carcrushers.cc/mod-queue?id=${context.params.id}&type=gma`,
executor: context.data.current_user.id,
id: crypto.randomUUID(),
target: appeal.roblox_id,
},
});
await context.env.DATA.put(
`gameappealblock_${appeal.roblox_id}`,
`${Date.now() + 2592000000}`,
{ expirationTtl: 2592000 },
);
return new Response(null, {
status: 204,
});
}