···22import { db } from "./db";
33import indexHTML from "./html/index.html";
44import loginHTML from "./html/login.html";
55+import profileHTML from "./html/profile.html";
56import { canRegister, registerOptions, registerVerify, loginOptions, loginVerify } from "./routes/auth";
66-import { hello } from "./routes/api";
77+import { hello, listUsers, getProfile, updateProfile } from "./routes/api";
7889(() => {
910 const required = ["ORIGIN", "RP_ID"];
···2324 routes: {
2425 "/": indexHTML,
2526 "/login": loginHTML,
2727+ "/profile": profileHTML,
2628 // API endpoints
2729 "/api/hello": hello,
3030+ "/api/users": listUsers,
3131+ "/api/profile": (req: Request) => {
3232+ if (req.method === "GET") return getProfile(req);
3333+ if (req.method === "PUT") return updateProfile(req);
3434+ return new Response("Method not allowed", { status: 405 });
3535+ },
2836 "/auth/can-register": canRegister,
2937 "/auth/register/options": registerOptions,
3038 "/auth/register/verify": registerVerify,
+6
src/migrations/002_add_user_status_role.sql
···11+-- Add status and role columns to users table
22+ALTER TABLE users ADD COLUMN status TEXT NOT NULL DEFAULT 'active' CHECK(status IN ('active', 'suspended', 'inactive'));
33+ALTER TABLE users ADD COLUMN role TEXT NOT NULL DEFAULT 'user';
44+55+-- Update existing admin users to have 'admin' role
66+UPDATE users SET role = 'admin' WHERE is_admin = 1;