v0.71.0: admin panel — users table, login/sessions, generic DB CRUD modal
CI / build + unit + e2e (pull_request) Failing after 13m35s
CI / build + unit + e2e (pull_request) Failing after 13m35s
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { requireAdmin } from '@/lib/auth';
|
||||
|
||||
// v0.71.0 — GET /api/admin/tables (admin only). Lists every user table as [{ name }] in name
|
||||
// order, excluding SQLite internals (sqlite_%). Feeds the Admin modal's table picker.
|
||||
|
||||
export async function GET(req: Request) {
|
||||
const guard = await requireAdmin(req);
|
||||
if (!guard.ok) return guard.response;
|
||||
|
||||
const res = guard.inst.raw.exec(
|
||||
"SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%' ORDER BY name",
|
||||
);
|
||||
return Response.json(res[0].values.map((r) => ({ name: String(r[0]) })));
|
||||
}
|
||||
Reference in New Issue
Block a user