task approval updates
Deploy / deploy (push) Successful in 2m38s

This commit is contained in:
twotalesanimation
2026-06-11 15:55:57 +02:00
parent b640fa472c
commit 7788907a4a
3 changed files with 99 additions and 14 deletions
+15
View File
@@ -113,6 +113,21 @@ export async function POST(
if (version.task) {
if (status === "APPROVED") {
await db.task.update({ where: { id: version.task.id }, data: { status: "DONE" } });
// If this version belongs to a shot that is shared with the client,
// also approve the shot at the shot level so it moves to COMPLETE.
if (version.task.shot) {
const shot = await db.shot.findUnique({
where: { id: version.task.shot.id },
select: { sharedWithClient: true, shotApprovalStatus: true },
});
if (shot?.sharedWithClient && shot.shotApprovalStatus !== "CLIENT_APPROVED") {
await db.shot.update({
where: { id: version.task.shot.id },
data: { shotApprovalStatus: "CLIENT_APPROVED", status: "COMPLETE" },
});
}
}
} else {
await db.task.update({ where: { id: version.task.id }, data: { status: "CHANGES" } });
}