Files
vfxreview/app/(dashboard)/shot-status/page.tsx
T
twotalesanimation c2509512ff
Deploy / deploy (push) Successful in 3m34s
feat(delivery): record shots delivered outside the render pipeline
Shots delivered by hand before the pipeline have no Export, so they could
never appear in a DeliveryPackage and the dashboard countdown showed them
as not delivered. Add Shot.manualDeliveredAt/ById/Note, a "Delivered
Outside Pipeline" bulk action on Shot Status (mark with the real date, or
clear), a badge on marked shots, and count them in the countdown alongside
DELIVERED EXR packages. The real date keeps the weekly rate honest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 04:03:56 +02:00

97 lines
2.8 KiB
TypeScript

import { db } from "@/lib/db";
import { auth } from "@/auth";
import { redirect } from "next/navigation";
import { ShotStatusClient } from "./ShotStatusClient";
async function getProjects() {
return db.project.findMany({
where: { status: { in: ["ACTIVE", "ON_HOLD"] } },
select: { id: true, name: true, code: true, projectType: true },
orderBy: { name: "asc" },
});
}
async function getEpisodeDueDatesForProject(projectId: string) {
return db.episodeDueDate.findMany({
where: { projectId },
select: { episode: true, dueDate: true },
orderBy: { episode: "asc" },
});
}
/** Everyone a shot can be handed to — clients and deactivated accounts excluded. */
async function getAssignableArtists() {
return db.user.findMany({
where: { isActive: true, role: { not: "CLIENT" } },
select: { id: true, name: true, email: true, image: true },
orderBy: { name: "asc" },
});
}
async function getShotsForProject(projectId: string) {
return db.shot.findMany({
where: { projectId },
orderBy: [
{ episode: { sort: "asc", nulls: "last" } },
{ scene: "asc" },
{ shotNumber: "asc" },
],
select: {
id: true,
shotCode: true,
scene: true,
episode: true,
shotNumber: true,
status: true,
priority: true,
dueDate: true,
thumbnailUrl: true,
generatedThumbnailUrl: true,
notes: true,
description: true,
isKeyShot: true,
isScaled: true,
manualDeliveredAt: true,
manualDeliveryNote: 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 } },
},
});
}
export default async function ShotStatusPage({
searchParams,
}: {
searchParams: Promise<{ projectId?: string }>;
}) {
const session = await auth();
if (!session?.user) redirect("/login");
const { projectId } = await searchParams;
const canManage = ["ADMIN", "PRODUCER", "SUPERVISOR"].includes(session.user.role);
const [projects, shots, episodeDueDates, artists] = await Promise.all([
getProjects(),
projectId ? getShotsForProject(projectId) : Promise.resolve([]),
projectId ? getEpisodeDueDatesForProject(projectId) : Promise.resolve([]),
canManage ? getAssignableArtists() : Promise.resolve([]),
]);
const selectedProject = projects.find((p) => p.id === projectId) ?? null;
return (
<ShotStatusClient
projects={projects}
selectedProjectId={projectId ?? null}
selectedProject={selectedProject}
shots={shots as any}
episodeDueDates={episodeDueDates}
artists={artists}
canManage={canManage}
/>
);
}