Shows what last reached the client with evidence (shared EXR package or manual delivery), anything newer still on its way, and the last review MOV, so it's clear on Shot Status what has actually been sent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import { db } from "@/lib/db";
|
||||
import { auth } from "@/auth";
|
||||
import { redirect } from "next/navigation";
|
||||
import { ShotStatusClient } from "./ShotStatusClient";
|
||||
import { summariseShotDelivery } from "@/lib/render-pipeline/shot-delivery-summary";
|
||||
|
||||
async function getProjects() {
|
||||
return db.project.findMany({
|
||||
@@ -29,7 +30,7 @@ async function getAssignableArtists() {
|
||||
}
|
||||
|
||||
async function getShotsForProject(projectId: string) {
|
||||
return db.shot.findMany({
|
||||
const shots = await db.shot.findMany({
|
||||
where: { projectId },
|
||||
orderBy: [
|
||||
{ episode: { sort: "asc", nulls: "last" } },
|
||||
@@ -53,13 +54,55 @@ async function getShotsForProject(projectId: string) {
|
||||
isScaled: true,
|
||||
manualDeliveredAt: true,
|
||||
manualDeliveryNote: true,
|
||||
manualDeliverySharedWith: true,
|
||||
// The shot-level version the panel burns into overlays and queueExport
|
||||
// renders under — not the count of review Versions uploaded.
|
||||
shotVersion: true,
|
||||
artist: { select: { id: true, name: true, image: true, email: true } },
|
||||
shotGroup: { select: { id: true, name: true } },
|
||||
// Every export, for the packages each went into; the newest live one
|
||||
// is what is on its way.
|
||||
exports: {
|
||||
orderBy: [{ versionNumber: "desc" }, { createdAt: "desc" }],
|
||||
select: {
|
||||
versionString: true,
|
||||
status: true,
|
||||
deliveryItems: {
|
||||
select: {
|
||||
versionString: true,
|
||||
package: {
|
||||
select: {
|
||||
kind: true,
|
||||
status: true,
|
||||
packageNumber: true,
|
||||
createdAt: true,
|
||||
builtAt: true,
|
||||
uploadedAt: true,
|
||||
deliveredAt: true,
|
||||
sharedWith: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return shots.map(({ exports, ...shot }) => ({
|
||||
...shot,
|
||||
delivery: summariseShotDelivery({
|
||||
packages: exports.flatMap((e) =>
|
||||
e.deliveryItems.map((item) => ({ ...item.package, versionString: item.versionString }))
|
||||
),
|
||||
manual: {
|
||||
deliveredAt: shot.manualDeliveredAt,
|
||||
sharedWith: shot.manualDeliverySharedWith,
|
||||
note: shot.manualDeliveryNote,
|
||||
},
|
||||
latestExport: exports.find((e) => e.status !== "CANCELLED" && e.status !== "ARCHIVED") ?? null,
|
||||
}),
|
||||
}));
|
||||
}
|
||||
|
||||
export default async function ShotStatusPage({
|
||||
|
||||
Reference in New Issue
Block a user