feat(deliveries): delivery requests and upload/share evidence
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>
This commit is contained in:
twotalesanimation
2026-09-30 14:21:24 +02:00
parent 326d8cbefa
commit f30acef101
25 changed files with 2241 additions and 52 deletions
@@ -0,0 +1,8 @@
-- "Delivered" used to be one click with nothing behind it. Record the upload
-- location and who was sent the link, so a package only becomes DELIVERED once
-- both have actually happened. Packages delivered before this keep NULLs here.
ALTER TABLE "delivery_packages" ADD COLUMN "uploadUrl" TEXT;
ALTER TABLE "delivery_packages" ADD COLUMN "uploadedAt" TIMESTAMP(3);
ALTER TABLE "delivery_packages" ADD COLUMN "uploadedById" TEXT;
ALTER TABLE "delivery_packages" ADD COLUMN "sharedWith" TEXT;
ALTER TABLE "delivery_packages" ADD COLUMN "sharedNote" TEXT;
@@ -0,0 +1,44 @@
-- Delivery requests: what a client asked for, tracked until it has gone out
-- with evidence. Closure is derived from packages and manual deliveries, so
-- there is no status column to fall out of step.
CREATE TABLE "delivery_requests" (
"id" TEXT NOT NULL,
"projectId" TEXT NOT NULL,
"requestNumber" INTEGER NOT NULL,
"episode" TEXT NOT NULL DEFAULT '',
"deliverable" TEXT NOT NULL DEFAULT 'EXR',
"requestedBy" TEXT NOT NULL,
"note" TEXT,
"dueDate" TIMESTAMP(3),
"createdById" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"cancelledAt" TIMESTAMP(3),
"cancelledById" TEXT,
"cancelReason" TEXT,
CONSTRAINT "delivery_requests_pkey" PRIMARY KEY ("id")
);
CREATE TABLE "delivery_request_lines" (
"id" TEXT NOT NULL,
"requestId" TEXT NOT NULL,
"shotId" TEXT NOT NULL,
"shotCode" TEXT NOT NULL,
"clientCode" TEXT,
CONSTRAINT "delivery_request_lines_pkey" PRIMARY KEY ("id")
);
CREATE UNIQUE INDEX "delivery_requests_projectId_requestNumber_key" ON "delivery_requests"("projectId", "requestNumber");
CREATE INDEX "delivery_requests_projectId_cancelledAt_idx" ON "delivery_requests"("projectId", "cancelledAt");
CREATE UNIQUE INDEX "delivery_request_lines_requestId_shotId_key" ON "delivery_request_lines"("requestId", "shotId");
CREATE INDEX "delivery_request_lines_shotId_idx" ON "delivery_request_lines"("shotId");
ALTER TABLE "delivery_requests" ADD CONSTRAINT "delivery_requests_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "projects"("id") ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE "delivery_request_lines" ADD CONSTRAINT "delivery_request_lines_requestId_fkey" FOREIGN KEY ("requestId") REFERENCES "delivery_requests"("id") ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE "delivery_request_lines" ADD CONSTRAINT "delivery_request_lines_shotId_fkey" FOREIGN KEY ("shotId") REFERENCES "shots"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- A manual delivery closes a request line only with the same evidence a
-- package carries: where it was uploaded and who was sent the link.
ALTER TABLE "shots" ADD COLUMN "manualDeliveryUrl" TEXT;
ALTER TABLE "shots" ADD COLUMN "manualDeliverySharedWith" TEXT;
+60 -1
View File
@@ -380,6 +380,7 @@ model Project {
/// is why it lives here rather than in per-machine panel settings.
pipelineConfig Json?
deliveryPackages DeliveryPackage[]
deliveryRequests DeliveryRequest[]
@@map("projects")
}
@@ -463,6 +464,11 @@ model Shot {
manualDeliveredAt DateTime?
manualDeliveredById String?
manualDeliveryNote String? @db.Text
/// Where a manual delivery was uploaded and who was sent the link. Optional
/// for a backfill, but a manual delivery only closes a DeliveryRequest line
/// when both are present — the same evidence a package needs.
manualDeliveryUrl String?
manualDeliverySharedWith String?
// Netflix slate fields — managed via the Slate tab, used by the preview pipeline
slateType String?
slateDescription String? @db.Text
@@ -480,6 +486,7 @@ model Shot {
references ShotReference[]
loggedTakes Take[] @relation("TakeToShot")
exports Export[]
deliveryRequestLines DeliveryRequestLine[]
@@unique([projectId, shotCode])
@@map("shots")
@@ -1155,7 +1162,16 @@ model DeliveryPackage {
createdById String
createdAt DateTime @default(now())
builtAt DateTime?
deliveredAt DateTime?
// Handoff evidence. Built is not delivered: the folder still has to be
// uploaded to the client's portal and the link sent to a person, and each of
// those is recorded separately so a package cannot be "delivered" on a hunch.
uploadUrl String? // where it lives on the client's side (Content Hub folder)
uploadedAt DateTime?
uploadedById String?
sharedWith String? // who was sent the link
sharedNote String?
deliveredAt DateTime? // when the link was shared — the package is DELIVERED from here
deliveredById String?
items DeliveryItem[]
@@ -1196,6 +1212,49 @@ model DeliveryItem {
@@map("delivery_items")
}
/// Something a client asked for ("EXRs for 116"), logged by hand because the
/// ask arrives over chat. It has no status of its own: a line is closed when
/// its shot has gone out with evidence after the request was logged, and the
/// request is closed when every line is — so it cannot be ticked off by hand.
model DeliveryRequest {
id String @id @default(cuid())
projectId String
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
requestNumber Int // sequential per project → "Request #4"
episode String @default("") // set when a whole episode was asked for
deliverable String @default("EXR") // EXR | MOV | EXR_AND_MOV — what the client asked for
requestedBy String // who at the client asked
note String? @db.Text
dueDate DateTime?
createdById String
createdAt DateTime @default(now())
cancelledAt DateTime?
cancelledById String?
cancelReason String?
lines DeliveryRequestLine[]
@@unique([projectId, requestNumber])
@@index([projectId, cancelledAt])
@@map("delivery_requests")
}
/// One requested shot. The shot list is a snapshot taken when the request was
/// logged; codes are denormalised for the same reason DeliveryItem's are.
model DeliveryRequestLine {
id String @id @default(cuid())
requestId String
request DeliveryRequest @relation(fields: [requestId], references: [id], onDelete: Cascade)
shotId String
shot Shot @relation(fields: [shotId], references: [id], onDelete: Cascade)
shotCode String
clientCode String?
@@unique([requestId, shotId])
@@index([shotId])
@@map("delivery_request_lines")
}
model SketchTemplate {
id String @id @default(cuid())
name String