@@ -459,6 +459,26 @@ export async function removeFootagePlate(plateId: string) {
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
export async function deleteShot(shotId: string) {
|
||||
const session = await auth();
|
||||
if (!session?.user) throw new Error("Unauthorized");
|
||||
|
||||
const role = session.user.role as string;
|
||||
if (!["ADMIN", "PRODUCER", "SUPERVISOR"].includes(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.delete({ where: { id: shotId } });
|
||||
|
||||
revalidatePath(`/projects/${shot.projectId}`);
|
||||
|
||||
return { success: true, projectId: shot.projectId };
|
||||
}
|
||||
|
||||
export async function renameFootagePlate(plateId: string, label: string) {
|
||||
const session = await auth();
|
||||
if (!session?.user) throw new Error("Unauthorized");
|
||||
|
||||
Reference in New Issue
Block a user