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
+49
View File
@@ -57,6 +57,7 @@ export async function GET(
exrOutput: true,
seqTimecodeStart: true,
seqTimecodeEnd: true,
shotVersion: true,
createdAt: true,
updatedAt: true,
project: {
@@ -102,3 +103,51 @@ export async function GET(
return NextResponse.json({ shot });
}
// ── PATCH /api/ext/shots/[shotId] ─────────────────────────────────────────────
//
// Update mutable shot fields from pipeline tools.
// Currently supports: shotVersion (format v###)
//
// Body (JSON): { shotVersion?: string }
// Returns: { success: true, shot: { id, shotVersion } }
export async function PATCH(
req: NextRequest,
{ params }: { params: Promise<{ shotId: string }> }
) {
if (!isAuthorized(req)) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
const { shotId } = await params;
const body = await req.json().catch(() => ({}));
const { shotVersion } = body as { shotVersion?: string };
if (shotVersion !== undefined) {
if (!/^v\d{3}$/.test(shotVersion)) {
return NextResponse.json(
{ error: "shotVersion must match format v### (e.g. v001)" },
{ status: 400 }
);
}
} else {
return NextResponse.json({ error: "No updatable fields provided" }, { status: 400 });
}
const shot = await db.shot.findUnique({
where: { id: shotId },
select: { id: true },
});
if (!shot) {
return NextResponse.json({ error: "Shot not found" }, { status: 404 });
}
const updated = await db.shot.update({
where: { id: shotId },
data: { ...(shotVersion !== undefined && { shotVersion }) },
select: { id: true, shotVersion: true },
});
return NextResponse.json({ success: true, shot: updated });
}
+1
View File
@@ -65,6 +65,7 @@ export async function GET(req: NextRequest) {
exrOutput: true,
seqTimecodeStart: true,
seqTimecodeEnd: true,
shotVersion: true,
thumbnailUrl: true,
createdAt: true,
updatedAt: true,