caaa333f02
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>
114 lines
3.5 KiB
TypeScript
114 lines
3.5 KiB
TypeScript
import { NextRequest, NextResponse } from "next/server";
|
||
import { db } from "@/lib/db";
|
||
import { shotThumbnail } from "@/lib/shot-thumbnail";
|
||
|
||
// ── Auth ─────────────────────────────────────────────────────────────────────
|
||
|
||
function isAuthorized(req: NextRequest): boolean {
|
||
const apiKey = process.env.API_SECRET_KEY;
|
||
if (!apiKey) return false;
|
||
const authHeader = req.headers.get("authorization") ?? "";
|
||
if (authHeader.startsWith("Bearer ")) return authHeader.slice(7) === apiKey;
|
||
return (req.headers.get("x-api-key") ?? "") === apiKey;
|
||
}
|
||
|
||
// ── GET /api/ext/shots/lookup ─────────────────────────────────────────────────
|
||
//
|
||
// Look up a single shot by its shot code and (optionally) project code.
|
||
// Designed for use in Nuke/After Effects/Blender pipeline tools.
|
||
//
|
||
// Query params:
|
||
// shotCode (required) e.g. UNG_108_004_010
|
||
// projectCode (recommended) e.g. UNG_108 – disambiguates if same code appears across projects
|
||
//
|
||
// Example:
|
||
// GET /api/ext/shots/lookup?shotCode=UNG_108_004_010&projectCode=UNG_108
|
||
// Authorization: Bearer <API_SECRET_KEY>
|
||
|
||
export async function GET(req: NextRequest) {
|
||
if (!isAuthorized(req)) {
|
||
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
||
}
|
||
|
||
const { searchParams } = new URL(req.url);
|
||
const shotCode = searchParams.get("shotCode")?.trim();
|
||
const projectCode = searchParams.get("projectCode")?.trim();
|
||
|
||
if (!shotCode) {
|
||
return NextResponse.json({ error: "shotCode query param is required" }, { status: 400 });
|
||
}
|
||
|
||
const shot = await db.shot.findFirst({
|
||
where: {
|
||
shotCode,
|
||
...(projectCode ? { project: { code: projectCode } } : {}),
|
||
},
|
||
select: {
|
||
id: true,
|
||
shotCode: true,
|
||
scene: true,
|
||
episode: true,
|
||
sequence: true,
|
||
shotNumber: true,
|
||
description: true,
|
||
notes: true,
|
||
status: true,
|
||
priority: true,
|
||
frameStart: true,
|
||
frameEnd: true,
|
||
fps: true,
|
||
dueDate: true,
|
||
// EDL / pull CSV fields
|
||
sourceClip: true,
|
||
timecodeStart: true,
|
||
timecodeEnd: true,
|
||
clipDuration: true,
|
||
exrOutput: true,
|
||
seqTimecodeStart: true,
|
||
seqTimecodeEnd: true,
|
||
shotVersion: true,
|
||
thumbnailUrl: true,
|
||
generatedThumbnailUrl: true,
|
||
createdAt: true,
|
||
updatedAt: true,
|
||
project: {
|
||
select: { id: true, name: true, code: true, showId: true },
|
||
},
|
||
artist: {
|
||
select: { id: true, name: true, email: true },
|
||
},
|
||
tasks: {
|
||
orderBy: { sortOrder: "asc" },
|
||
select: {
|
||
id: true,
|
||
title: true,
|
||
type: true,
|
||
status: true,
|
||
},
|
||
},
|
||
versions: {
|
||
where: { isLatest: true },
|
||
take: 1,
|
||
select: {
|
||
id: true,
|
||
versionNumber: true,
|
||
approvalStatus: true,
|
||
reviewStatus: true,
|
||
fileUrl: true,
|
||
thumbnailUrl: true,
|
||
createdAt: true,
|
||
},
|
||
},
|
||
},
|
||
});
|
||
|
||
if (!shot) {
|
||
return NextResponse.json({ error: "Shot not found" }, { status: 404 });
|
||
}
|
||
|
||
const { generatedThumbnailUrl, ...rest } = shot;
|
||
return NextResponse.json({
|
||
shot: { ...rest, thumbnailUrl: shotThumbnail(shot) },
|
||
});
|
||
}
|