feat(admin): DB CRUD panel + /api/admin endpoints (#38)
CI / build + unit + e2e (pull_request) Successful in 3m47s

- ADMIN button in the mission-control header opens a table picker + row grid with add/edit/delete (components/admin-panel.tsx), deliberately unauthenticated by explicit request
- /api/admin/tables and /api/admin/tables/{name}/rows driven off a name→table registry built from lib/db/schema.ts (lib/db/admin.ts) — no per-table code; 404 unknown table, 400 malformed payload, 409 constraint violation
- OpenAPI spec updated for all four admin operations + Admin* schemas
- unit: lib/db/admin.test.ts (registry, CRUD round-trips, composite PKs, error mapping); e2e: read-only admin.spec.ts
This commit is contained in:
2026-09-29 21:48:15 +00:00
parent be11aac356
commit 0d2370850f
11 changed files with 1098 additions and 1 deletions
+9
View File
@@ -1,7 +1,9 @@
'use client'
import { useCallback, useEffect, useState } from 'react'
import { AdminPanel } from '@/components/admin-panel'
import { Badge } from '@/components/ui/badge'
import { Button } from '@/components/ui/button'
import { Panel, PanelContent, PanelHeader, PanelTitle } from '@/components/ui/panel'
import { Progress } from '@/components/ui/progress'
import { StatCard } from '@/components/ui/stat-card'
@@ -57,6 +59,8 @@ export function MissionControl() {
// #27 — the active tab survives a page refresh. Restored from localStorage on mount; null until
// then so SSR and the first client render agree on the default tab (no hydration mismatch).
const [activeTab, setActiveTab] = useState<string | null>(null)
// #38 — admin DB CRUD overlay, opened from the header.
const [adminOpen, setAdminOpen] = useState(false)
useEffect(() => {
let cancelled = false
@@ -210,6 +214,9 @@ export function MissionControl() {
<Badge variant="SCANNING">SECTOR SCAN</Badge>
{/* #38 — admin DB CRUD, no auth by design (see components/admin-panel.tsx) */}
<Button size="SM" onClick={() => setAdminOpen(true)}>ADMIN</Button>
<span
style={{
color: 'var(--color-green)',
@@ -225,6 +232,8 @@ export function MissionControl() {
</span>
</header>
{adminOpen && <AdminPanel onClose={() => setAdminOpen(false)} />}
{/* ── BODY ── */}
<div
style={{