Migrate the rest of the easy stuff
All checks were successful
Test, Build, Deploy / Test, Build, and Deploy (push) Successful in 58s
Test, Build, Deploy / Create Sentry Release (push) Successful in 6s

This commit is contained in:
2026-04-11 04:32:09 -04:00
parent 48631e32be
commit 5c17f87f89
13 changed files with 244 additions and 177 deletions

View File

@@ -7,19 +7,25 @@ export async function onRequestPost(context: RequestContext) {
if (statsReduction && typeof statsReduction !== "number")
return jsonError("Invalid stat reduction", 400);
const appeal: Record<string, any> | null = await context.env.D1.prepare(
"SELECT * FROM game_appeals WHERE id = ?;",
)
.bind(context.params.id)
.first();
const appeal = await context.data.prisma.gameAppeal.findUnique({
select: {
roblox_id: true,
type: true,
},
where: {
id: context.params.id as string,
},
});
if (!appeal) return jsonError("Appeal not found", 400);
const { etag, value: banList } = await getBanList(context);
await context.env.D1.prepare("DELETE FROM game_appeals WHERE id = ?;")
.bind(context.params.id)
.run();
await context.data.prisma.gameAppeal.delete({
where: {
id: context.params.id as string,
},
});
if (!banList[appeal.roblox_id]?.BanType)
return new Response(null, {
@@ -46,18 +52,15 @@ export async function onRequestPost(context: RequestContext) {
};
}
await context.env.D1.prepare(
"INSERT INTO game_mod_logs (action, evidence, executed_at, executor, id, target) VALUES (?, ?, ?, ?, ?, ?);",
)
.bind(
`accept appeal | ${banList[appeal.roblox_id]?.BanType === 2 ? "ban" : appeal.type}`,
`https://carcrushers.cc/mod-queue?id=${context.params.id}&type=gma`,
Date.now(),
context.data.current_user.id,
crypto.randomUUID(),
appeal.roblox_id,
)
.run();
await context.data.prisma.gameModLog.create({
data: {
action: `accept 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 setBanList(context, banList, etag);