import { headers } from "next/headers"; import { NextResponse } from "next/server"; import { auth } from "@/lib/auth/server"; import { getSystemHealth } from "@/lib/services/system-health"; export async function GET() { const session = await auth.api.getSession({ headers: await headers() }); if (!session) { return NextResponse.json({ error: "Unauthorized" }, { status: 401 }); } if (session.user.role !== "admin") { return NextResponse.json({ error: "Forbidden" }, { status: 403 }); } const health = await getSystemHealth(); return NextResponse.json(health); }