API Updates
Deploy / deploy (push) Successful in 3m3s

This commit is contained in:
twotalesanimation
2026-07-08 14:38:56 +02:00
parent d40ca8eb55
commit afcef02409
9 changed files with 399 additions and 4 deletions
+10
View File
@@ -9,6 +9,7 @@ import { recalcShotStatus } from "@/lib/shot-status";
import { notifyApprovalChange } from "@/lib/notifications";
import { slackNotifyApproval } from "@/lib/slack";
import { versionLabel } from "@/lib/utils";
import { createDisplayEvent } from "@/lib/display-events";
const approvalSchema = z.object({
versionId: z.string().cuid(),
@@ -107,6 +108,15 @@ export async function submitApproval(data: z.infer<typeof approvalSchema>) {
}
}
// Display board event
const contextCode = version.task?.shot?.shotCode ?? version.task?.title ?? null;
if (contextCode && parsed.status !== "PENDING_REVIEW") {
const displayType =
parsed.status === "APPROVED" ? "APPROVED" :
parsed.status === "NEEDS_CHANGES" ? "CHANGES" : "REJECTED";
await createDisplayEvent(displayType, contextCode, reviewerName);
}
revalidatePath(`/review/${parsed.versionId}`);
if (version.task) {
revalidatePath(`/tasks/${version.task.id}`);
+5
View File
@@ -6,6 +6,7 @@ import { revalidatePath } from "next/cache";
import { z } from "zod";
import { notifyFeedbackAdded, notifyCommentReply } from "@/lib/notifications";
import { slackNotifyNewFeedback } from "@/lib/slack";
import { createDisplayEvent } from "@/lib/display-events";
const addCommentSchema = z.object({
versionId: z.string().cuid(),
@@ -79,6 +80,10 @@ export async function addComment(data: z.infer<typeof addCommentSchema>) {
});
}
// Display board event
const commenter = await db.user.findUnique({ where: { id: session.user.id }, select: { name: true } });
await createDisplayEvent("COMMENT", shotCode, commenter?.name ?? session.user.email ?? "Someone");
revalidatePath(`/review/${parsed.versionId}`);
return { success: true, comment };
}