Retrieve self-submitted appeals endpoint
This commit is contained in:
parent
a40665bd6c
commit
ac56a62a5d
13
functions/api/me/appeals.ts
Normal file
13
functions/api/me/appeals.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { jsonError, jsonResponse } from "../../common.js";
|
||||
|
||||
export async function onRequestGet(context: RequestContext) {
|
||||
const { results, success } = await context.env.D1.prepare(
|
||||
"SELECT approved, created_at, open FROM appeals WHERE user = ?;",
|
||||
)
|
||||
.bind(context.data.current_user.id)
|
||||
.all();
|
||||
|
||||
if (!success) return jsonError("Unable to retrieve appeals", 500);
|
||||
|
||||
return jsonResponse(JSON.stringify(results));
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user