f30acef101
Deploy / deploy (push) Successful in 5m17s
A built package used to become DELIVERED on one click with nothing behind it, and nothing recorded what a client had asked for. - Marking delivered is now two recorded steps: Record upload (the link on the client's portal, contents confirmed) then Share link (who it was sent to). The second is refused until the first is on record. - Delivery requests log a client's ask by episode, pasted shot codes or a Shot Status selection. A line closes only when its shot goes out with evidence after the request was logged; a request can otherwise only be cancelled with a reason. - Delivered Outside Pipeline takes an upload link and recipient, required for shots on an open request. - The dashboard gains an Awaiting delivery section listing open requests and built packages the client does not have yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1.3 KiB
TypeScript
35 lines
1.3 KiB
TypeScript
import { NextRequest, NextResponse } from "next/server";
|
|
import { toErrorResponse } from "@/lib/render-pipeline/errors";
|
|
import { requirePipelineAdmin } from "@/lib/render-pipeline/session-auth";
|
|
import { markUploaded } from "@/lib/render-pipeline/deliveries";
|
|
import { recordUploadSchema } from "@/lib/render-pipeline/delivery-handoff";
|
|
|
|
// ── POST /api/deliveries/{id}/uploaded ───────────────────────────────────────
|
|
//
|
|
// The folder is on the client's portal. Records where, so the package shows as
|
|
// waiting to be shared rather than waiting to be uploaded.
|
|
|
|
export async function POST(
|
|
req: NextRequest,
|
|
{ params }: { params: Promise<{ packageId: string }> }
|
|
) {
|
|
try {
|
|
const user = await requirePipelineAdmin();
|
|
const { packageId } = await params;
|
|
|
|
const parsed = recordUploadSchema.safeParse(await req.json().catch(() => null));
|
|
if (!parsed.success) {
|
|
return NextResponse.json(
|
|
{ error: parsed.error.issues[0]?.message ?? "Invalid request", details: parsed.error.issues },
|
|
{ status: 422 }
|
|
);
|
|
}
|
|
|
|
const result = await markUploaded(packageId, parsed.data, user.id);
|
|
return NextResponse.json(result);
|
|
} catch (err) {
|
|
const { body, status } = toErrorResponse(err);
|
|
return NextResponse.json(body, { status });
|
|
}
|
|
}
|