import { NextResponse } from "next/server"; import { withAuth } from "@/lib/api-auth"; import { apiError } from "@/lib/api-errors"; import { JobError, requestCancel } from "@/lib/jobs"; export const POST = withAuth>(async (_req, { params }) => { const { id } = await params; try { await requestCancel(id); return NextResponse.json({ ok: true }, { status: 202 }); } catch (err) { if (err instanceof JobError) return apiError(err.status, err.code, err.message); throw err; } });