Admin page

This commit is contained in:
2026-10-29 21:42:26 -03:00
parent 07e61d9dd1
commit f7f34e1a57
18 changed files with 369 additions and 13 deletions
+16
View File
@@ -0,0 +1,16 @@
import { define } from "@/utils.ts";
import type { MeResponse } from "@/src/admin.ts";
import { authenticate, unauthorized } from "@/src/auth.ts";
import type { User } from "@/src/db.ts";
export const handler = define.handlers({
async GET(ctx) {
const user = await authenticate(ctx.req);
if (!user) {
return unauthorized();
}
const { name, admin } = user as Partial<User>;
return Response.json({ id: user.id, name: name ?? "", admin: admin === true } satisfies MeResponse);
},
});