@@ -489,6 +489,40 @@ export async function updateShotNotes(shotId: string, notes: string) {
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
// ── Update Shot Slate Fields ──────────────────────────────────────────────────
|
||||
|
||||
export async function updateShotSlate(
|
||||
shotId: string,
|
||||
data: {
|
||||
slateType?: string | null;
|
||||
slateDescription?: string | null;
|
||||
slateVfxScope?: string | null;
|
||||
slateSubmissionNote?: string | null;
|
||||
}
|
||||
) {
|
||||
const session = await auth();
|
||||
if (!session?.user) throw new Error("Unauthorized");
|
||||
if (!["ADMIN", "PRODUCER", "SUPERVISOR"].includes(session.user.role)) {
|
||||
throw new Error("Insufficient permissions");
|
||||
}
|
||||
|
||||
const shot = await db.shot.findUnique({ where: { id: shotId }, select: { projectId: true } });
|
||||
if (!shot) throw new Error("Shot not found");
|
||||
|
||||
await db.shot.update({
|
||||
where: { id: shotId },
|
||||
data: {
|
||||
slateType: data.slateType !== undefined ? (data.slateType?.trim() || null) : undefined,
|
||||
slateDescription: data.slateDescription !== undefined ? (data.slateDescription?.trim() || null) : undefined,
|
||||
slateVfxScope: data.slateVfxScope !== undefined ? (data.slateVfxScope?.trim() || null) : undefined,
|
||||
slateSubmissionNote: data.slateSubmissionNote !== undefined ? (data.slateSubmissionNote?.trim() || null) : undefined,
|
||||
},
|
||||
});
|
||||
|
||||
revalidatePath(`/projects/${shot.projectId}`);
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
// ── Toggle Key Shot ───────────────────────────────────────────────────────────
|
||||
|
||||
export async function toggleKeyShot(shotId: string, isKeyShot: boolean) {
|
||||
|
||||
Reference in New Issue
Block a user