versioning added
Deploy / deploy (push) Successful in 3m12s

This commit is contained in:
twotalesanimation
2026-06-25 22:19:22 +02:00
parent 935a293777
commit 75d5149bea
8 changed files with 172 additions and 3 deletions
+32
View File
@@ -970,3 +970,35 @@ export async function clientRequestShotChanges(shotId: string, taskId?: string)
revalidatePath(`/shot-status`);
return { success: true };
}
// ── Shot Version ──────────────────────────────────────────────────────────────
const VERSION_RE = /^v\d{3}$/;
/**
* Set or manually override the shot's version string (format: v###).
*/
export async function updateShotVersion(shotId: string, version: string) {
const session = await auth();
if (!session?.user) throw new Error("Unauthorized");
if (!["ADMIN", "PRODUCER", "SUPERVISOR"].includes(session.user.role)) {
throw new Error("Insufficient permissions");
}
if (!VERSION_RE.test(version)) {
throw new Error("Version must be in format v### (e.g. v001, v012)");
}
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: { shotVersion: version },
});
revalidatePath(`/projects/${shot.projectId}/shots/${shotId}`);
return { success: true, shotVersion: version };
}