feat(portal+admin): shared shell, customer portal (dashboard nav, subscriptions, settings) + admin portal (order queue w/ status actions, source registry) + admin/subscriptions APIs
PortalShell (sidebar + session bar via /api/auth/me + logout). Customer: /portal nav, /portal/subscriptions (create feed), /portal/settings (dev-login + DPA). Admin: /admin (metrics + order queue with inline status advance), /admin/sources. APIs: /api/admin/metrics, /api/subscriptions. tsc 0, build green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { listOrders } from "@/lib/orders-store";
|
||||
|
||||
// GET /api/admin/metrics — order queue aggregates for the admin dashboard.
|
||||
export async function GET() {
|
||||
const orders = await listOrders();
|
||||
const byStatus: Record<string, number> = {};
|
||||
let depositPaidOre = 0;
|
||||
let pipelineOre = 0;
|
||||
for (const o of orders) {
|
||||
byStatus[o.status] = (byStatus[o.status] ?? 0) + 1;
|
||||
if (o.status !== "draft") depositPaidOre += o.deposit_ore ?? 0;
|
||||
pipelineOre += o.total_ore ?? 0;
|
||||
}
|
||||
return NextResponse.json({
|
||||
total: orders.length,
|
||||
by_status: byStatus,
|
||||
in_production: byStatus["in_production"] ?? 0,
|
||||
review: byStatus["review"] ?? 0,
|
||||
delivered: byStatus["delivered"] ?? 0,
|
||||
deposit_paid_ore: depositPaidOre,
|
||||
pipeline_ore: pipelineOre,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user