feat(pipeline): render-derived shot thumbnails, and bulk shot delete
Deploy / deploy (push) Failing after 19m11s
Deploy / deploy (push) Failing after 19m11s
Two independent features landing together: Generated shot thumbnails — a shot can now carry a thumbnail promoted from a render export (Shot.generatedThumbnailUrl/generatedThumbnailFrom) alongside the existing brief-supplied thumbnailUrl, which always takes display precedence (lib/shot-thumbnail.ts) so a promoted frame can only ever fill a gap, never overwrite the brief. Shows with pipelineConfig.autoShotThumbnail promote automatically on every finished export (lib/render-pipeline/preview.ts); promoteExportThumbnail/ clearGeneratedThumbnail (actions/shots.ts) are the manual equivalent for everyone else. Worker-side seek logic for picking the promoted frame is covered by RenderWorker/VFXReviewWorker.Tests/ThumbnailSeekTests.cs. Bulk shot delete — the shot-status page's selection bar gets a "Bulk Actions" dropdown (alongside the existing Change Due Date) with Delete Shots. bulkDeleteShots() (actions/shots.ts) deletes one at a time rather than in a single statement: exports_shotId_fkey is ON DELETE RESTRICT by design, so a shot with renders or deliveries on record is protected and gets skipped and reported by name rather than aborting the whole selection or being silently destroyed along with its history. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { db } from "@/lib/db";
|
||||
import { validateReviewToken } from "@/lib/review-auth";
|
||||
import { shotThumbnail } from "@/lib/shot-thumbnail";
|
||||
|
||||
/** GET /api/client/[token]/project — returns project + shots with tasks that have client-visible versions */
|
||||
export async function GET(
|
||||
@@ -49,6 +50,7 @@ export async function GET(
|
||||
status: true,
|
||||
shotApprovalStatus: true,
|
||||
thumbnailUrl: true,
|
||||
generatedThumbnailUrl: true,
|
||||
tasks: {
|
||||
where: {
|
||||
versions: { some: { isClientVisible: true } },
|
||||
@@ -113,7 +115,12 @@ export async function GET(
|
||||
|
||||
return NextResponse.json({
|
||||
project,
|
||||
shots,
|
||||
// Shots the client sees resolve the same way as internally: the reference
|
||||
// still first, a render-derived one only where the show supplied none.
|
||||
shots: shots.map(({ generatedThumbnailUrl, ...shot }) => ({
|
||||
...shot,
|
||||
thumbnailUrl: shotThumbnail({ ...shot, generatedThumbnailUrl }),
|
||||
})),
|
||||
assetTasks,
|
||||
sessionLabel: session.label,
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { db } from "@/lib/db";
|
||||
import { shotThumbnail } from "@/lib/shot-thumbnail";
|
||||
|
||||
// ── Auth ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -91,6 +92,7 @@ export async function GET(
|
||||
seqTimecodeStart: true,
|
||||
seqTimecodeEnd: true,
|
||||
thumbnailUrl: true,
|
||||
generatedThumbnailUrl: true,
|
||||
artist: {
|
||||
select: { id: true, name: true, email: true },
|
||||
},
|
||||
@@ -111,6 +113,9 @@ export async function GET(
|
||||
return NextResponse.json({
|
||||
project,
|
||||
pagination: { page, limit, total, pages: Math.ceil(total / limit) },
|
||||
shots,
|
||||
shots: shots.map(({ generatedThumbnailUrl, ...shot }) => ({
|
||||
...shot,
|
||||
thumbnailUrl: shotThumbnail({ ...shot, generatedThumbnailUrl }),
|
||||
})),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { db } from "@/lib/db";
|
||||
import { shotThumbnail } from "@/lib/shot-thumbnail";
|
||||
|
||||
// ── Auth ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -67,6 +68,7 @@ export async function GET(req: NextRequest) {
|
||||
seqTimecodeEnd: true,
|
||||
shotVersion: true,
|
||||
thumbnailUrl: true,
|
||||
generatedThumbnailUrl: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
project: {
|
||||
@@ -104,5 +106,8 @@ export async function GET(req: NextRequest) {
|
||||
return NextResponse.json({ error: "Shot not found" }, { status: 404 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ shot });
|
||||
const { generatedThumbnailUrl, ...rest } = shot;
|
||||
return NextResponse.json({
|
||||
shot: { ...rest, thumbnailUrl: shotThumbnail(shot) },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { auth } from "@/auth";
|
||||
import { db } from "@/lib/db";
|
||||
import { shotThumbnail } from "@/lib/shot-thumbnail";
|
||||
|
||||
export async function GET(req: NextRequest) {
|
||||
const session = await auth();
|
||||
@@ -33,6 +34,7 @@ export async function GET(req: NextRequest) {
|
||||
shotApprovalStatus: true,
|
||||
sharedWithClient: true,
|
||||
thumbnailUrl: true,
|
||||
generatedThumbnailUrl: true,
|
||||
tasks: {
|
||||
select: {
|
||||
id: true,
|
||||
@@ -75,7 +77,7 @@ export async function GET(req: NextRequest) {
|
||||
status: shot.status,
|
||||
shotApprovalStatus: shot.shotApprovalStatus,
|
||||
sharedWithClient: shot.sharedWithClient,
|
||||
thumbnailUrl: shot.thumbnailUrl,
|
||||
thumbnailUrl: shotThumbnail(shot),
|
||||
latestVersion: {
|
||||
id: latest.id,
|
||||
versionNumber: latest.versionNumber,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { auth } from "@/auth";
|
||||
import { db } from "@/lib/db";
|
||||
import { shotThumbnail } from "@/lib/shot-thumbnail";
|
||||
|
||||
function requireRole(role: string) {
|
||||
return ["ADMIN", "PRODUCER", "SUPERVISOR"].includes(role);
|
||||
@@ -27,6 +28,7 @@ export async function GET(
|
||||
scene: true,
|
||||
episode: true,
|
||||
thumbnailUrl: true,
|
||||
generatedThumbnailUrl: true,
|
||||
references: {
|
||||
orderBy: { sortOrder: "asc" },
|
||||
select: {
|
||||
@@ -41,5 +43,9 @@ export async function GET(
|
||||
});
|
||||
|
||||
if (!shot) return NextResponse.json({ error: "Not found" }, { status: 404 });
|
||||
return NextResponse.json({ shot });
|
||||
|
||||
const { generatedThumbnailUrl, ...rest } = shot;
|
||||
return NextResponse.json({
|
||||
shot: { ...rest, thumbnailUrl: shotThumbnail(shot) },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { auth } from "@/auth";
|
||||
import { db } from "@/lib/db";
|
||||
import { shotThumbnail } from "@/lib/shot-thumbnail";
|
||||
|
||||
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -409,13 +410,18 @@ export async function GET(req: NextRequest) {
|
||||
where: { projectId },
|
||||
select: {
|
||||
id: true, shotCode: true, scene: true, episode: true, shotNumber: true,
|
||||
description: true, notes: true, status: true, thumbnailUrl: true,
|
||||
description: true, notes: true, status: true,
|
||||
thumbnailUrl: true, generatedThumbnailUrl: true,
|
||||
frameStart: true, frameEnd: true, fps: true, isKeyShot: true, shotVersion: true,
|
||||
shotGroup: { select: { id: true, name: true } },
|
||||
},
|
||||
orderBy: [{ episode: "asc" }, { scene: "asc" }, { shotNumber: "asc" }],
|
||||
});
|
||||
|
||||
// Collapse the two columns before anything reads them, so the "only shots
|
||||
// with thumbnails" filter and the page renderer agree on what counts as one.
|
||||
shots = shots.map((s) => ({ ...s, thumbnailUrl: shotThumbnail(s) }));
|
||||
|
||||
if (onlyThumbs) shots = shots.filter((s) => !!s.thumbnailUrl);
|
||||
if (epFilter.length) shots = shots.filter((s) => epFilter.includes(s.episode ?? ""));
|
||||
if (grpFilter.length) shots = shots.filter((s) => grpFilter.includes(s.shotGroup?.id ?? ""));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { auth } from "@/auth";
|
||||
import { db } from "@/lib/db";
|
||||
import { shotThumbnail } from "@/lib/shot-thumbnail";
|
||||
|
||||
// GET /api/storyboard/shots?projectId=xxx
|
||||
export async function GET(req: NextRequest) {
|
||||
@@ -26,6 +27,7 @@ export async function GET(req: NextRequest) {
|
||||
notes: true,
|
||||
status: true,
|
||||
thumbnailUrl: true,
|
||||
generatedThumbnailUrl: true,
|
||||
frameStart: true,
|
||||
frameEnd: true,
|
||||
fps: true,
|
||||
@@ -40,5 +42,12 @@ export async function GET(req: NextRequest) {
|
||||
],
|
||||
});
|
||||
|
||||
return NextResponse.json({ shots });
|
||||
// The reference still wins; a render-derived one fills the gap where a show
|
||||
// shipped no stills at all (lib/shot-thumbnail.ts).
|
||||
return NextResponse.json({
|
||||
shots: shots.map(({ generatedThumbnailUrl, ...shot }) => ({
|
||||
...shot,
|
||||
thumbnailUrl: shotThumbnail({ ...shot, generatedThumbnailUrl }),
|
||||
})),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user