23 lines
711 B
TypeScript
23 lines
711 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { requirePlatformRole } from "@/lib/session";
|
|
import { listPendingSkillActivationRequests } from "@/lib/db";
|
|
|
|
/**
|
|
* GET /api/admin/skills/pending
|
|
*
|
|
* List all pending skill-activation requests across all tenants
|
|
* and orgs. Powers the admin queue at /admin/skills/pending.
|
|
*
|
|
* Platform-role only. Returns up to 500 rows oldest-first so the
|
|
* queue UI shows the oldest requests at the top (FIFO).
|
|
*/
|
|
export async function GET() {
|
|
try {
|
|
await requirePlatformRole();
|
|
} catch {
|
|
return NextResponse.json({ error: "Forbidden" }, { status: 403 });
|
|
}
|
|
const rows = await listPendingSkillActivationRequests();
|
|
return NextResponse.json(rows);
|
|
}
|