Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Retrieve self-submitted appeals endpoint
  • Loading branch information
regalijan committed Oct 19, 2023
1 parent a40665b commit ac56a62
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions functions/api/me/appeals.ts
@@ -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));
}

0 comments on commit ac56a62

Please sign in to comment.