built user portal behind auth

This commit is contained in:
makearmy 2025-09-27 14:30:16 -04:00
parent 5c6962f4a5
commit 37d474d7c8
48 changed files with 822 additions and 496 deletions

View file

@ -44,13 +44,12 @@ export async function GET(req: NextRequest, ctx: any) {
const mapped = items.map((it) => ({
id: String(it.id ?? it.submission_id ?? ""),
label: pickLabel(it, cfg.labelFields),
name: pickLabel(it, cfg.labelFields),
_search: `${Object.values(it).join(" ")}`.toLowerCase(),
})).filter((m) => !!m.id);
const filtered = q ? mapped.filter((m) => m._search.includes(q)) : mapped;
filtered.sort((a, b) => a.label.localeCompare(b.label));
filtered.sort((a, b) => (a.name ?? "").localeCompare(b.name ?? ""));
return NextResponse.json({ data: filtered.map(({ _search, ...r }) => r) });
} catch (err: any) {
return NextResponse.json(