import { NextRequest, NextResponse } from "next/server"; import { isExtAuthorized } from "@/lib/render-pipeline/ext-auth"; import { toErrorResponse } from "@/lib/render-pipeline/errors"; import { getQCQueue } from "@/lib/render-pipeline/qc"; // ── GET /api/ext/qc/queue?projectCode=&episode= (E5) ───────────────────────── // // Exports sitting in READY_FOR_QC, oldest first, with everything the panel // needs to import the real EXR sequence for full-res QC. export async function GET(req: NextRequest) { if (!isExtAuthorized(req)) { return NextResponse.json({ error: "Unauthorized" }, { status: 401 }); } const { searchParams } = new URL(req.url); try { const result = await getQCQueue({ projectCode: searchParams.get("projectCode"), episode: searchParams.get("episode"), limit: searchParams.get("limit") ? Number(searchParams.get("limit")) : undefined, }); return NextResponse.json(result); } catch (err) { const { body, status } = toErrorResponse(err); return NextResponse.json(body, { status }); } }