feat: link takes to pipeline shots via dropdown selector
Deploy / deploy (push) Successful in 2m41s

This commit is contained in:
twotalesanimation
2026-07-11 21:26:52 +02:00
parent b9953ff543
commit 42e614c592
3 changed files with 135 additions and 1 deletions
+34
View File
@@ -0,0 +1,34 @@
import { NextRequest, NextResponse } from "next/server";
import { auth } from "@/auth";
import { db } from "@/lib/db";
function requireRole(role: string) {
return ["ADMIN", "PRODUCER", "SUPERVISOR"].includes(role);
}
// GET /api/shoot-log/shots?projectId=xxx
// Returns a lightweight shot list for the pipeline-link selector
export async function GET(req: NextRequest) {
const session = await auth();
if (!session?.user) return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
if (!requireRole(session.user.role))
return NextResponse.json({ error: "Forbidden" }, { status: 403 });
const projectId = req.nextUrl.searchParams.get("projectId");
if (!projectId) return NextResponse.json({ error: "projectId required" }, { status: 400 });
const shots = await db.shot.findMany({
where: { projectId },
select: {
id: true,
shotCode: true,
scene: true,
episode: true,
description: true,
status: true,
},
orderBy: [{ episode: "asc" }, { shotCode: "asc" }],
});
return NextResponse.json({ shots });
}
@@ -21,6 +21,7 @@ function sanitize(data: Record<string, unknown>) {
"hasSurvey","hasLidar","hasWitnessCamera","hasLensGrid","hasTexturePhotos","hasPhotogrammetry",
"weather","sunDirection","artificialLights",
"supervisorNotes","continuityNotes","vfxRequirements","quality",
"pipelineShotId",
]);
return Object.fromEntries(
Object.entries(data)