Add first game appeal endpoints
This commit is contained in:
16
functions/api/game-appeals/metadata.ts
Normal file
16
functions/api/game-appeals/metadata.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { jsonError, jsonResponse } from "../../common.js";
|
||||
import precheck from "./precheck.js";
|
||||
|
||||
export async function onRequestPost(context: RequestContext) {
|
||||
const { id }: { id: any } = context.data.body;
|
||||
|
||||
if (typeof id !== "number") return jsonError("Invalid user id", 400);
|
||||
|
||||
const precheckData = await precheck(context, id);
|
||||
|
||||
if (precheckData.error) return jsonError(precheckData.error, 500);
|
||||
|
||||
const { can_appeal, reason } = precheckData;
|
||||
|
||||
return jsonResponse(JSON.stringify({ can_appeal, reason }));
|
||||
}
|
Reference in New Issue
Block a user