import { jsonResponse } from "../../common.js";

export async function onRequestGet(context: RequestContext) {
  return jsonResponse(
    JSON.stringify(
      await context.data.prisma.appeal.findMany({
        select: {
          approved: true,
          created_at: true,
          id: true,
        },
        where: {
          user: {
            path: "id",
            equals: context.data.current_user.id,
          },
        },
      }),
    ),
  );
}
