added delete shots
Deploy / deploy (push) Successful in 3m57s

This commit is contained in:
twotalesanimation
2026-05-24 01:13:21 +02:00
parent 2aa76655bb
commit 2020f59152
2 changed files with 84 additions and 3 deletions
+20
View File
@@ -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");