Accept type property in appeal submissions

This commit is contained in:
2025-08-07 02:28:15 -04:00
parent 513234bbe6
commit 41f361fcf1

View File

@ -7,11 +7,13 @@ export async function onRequestPost(context: RequestContext) {
if (authHeader !== context.env.ROBLOX_APPEALS_TOKEN) if (authHeader !== context.env.ROBLOX_APPEALS_TOKEN)
return jsonError("Unauthorized", 401); return jsonError("Unauthorized", 401);
const { id, reasonForUnban, username, whatHappened } = context.data.body; const { id, reasonForUnban, type, username, whatHappened } =
context.data.body;
if ( if (
typeof id !== "number" || typeof id !== "number" ||
typeof reasonForUnban !== "string" || typeof reasonForUnban !== "string" ||
!["ban", "leaderboard", "server_configurator"].includes(type) ||
typeof username !== "string" || typeof username !== "string" ||
typeof whatHappened !== "string" typeof whatHappened !== "string"
) )
@ -48,9 +50,17 @@ export async function onRequestPost(context: RequestContext) {
}${Date.now()}`; }${Date.now()}`;
await context.env.D1.prepare( await context.env.D1.prepare(
"INSERT INTO game_appeals (created_at, id, reason_for_unban, roblox_id, roblox_username, what_happened) VALUES (?, ?, ?, ?, ?, ?);", "INSERT INTO game_appeals (created_at, id, reason_for_unban, roblox_id, roblox_username, type, what_happened) VALUES (?, ?, ?, ?, ?, ?, ?);",
) )
.bind(Date.now(), appealId, reasonForUnban, id, username, whatHappened) .bind(
Date.now(),
appealId,
reasonForUnban,
id,
username,
type,
whatHappened,
)
.run(); .run();
await fetch(context.env.REPORTS_WEBHOOK, { await fetch(context.env.REPORTS_WEBHOOK, {