import { NextResponse } from "next/server"; import { approveJob } from "@/lib/agent-downloads"; import { withAuth } from "@/lib/api-auth"; import { apiError } from "@/lib/api-errors"; import { JobError } from "@/lib/jobs"; /** Let a download requested through the API start. */ export const POST = withAuth>(async (_req, { params }) => { const { id } = await params; try { await approveJob(id); return NextResponse.json({ ok: true }); } catch (err) { if (err instanceof JobError) return apiError(err.status, err.code, err.message); throw err; } });