@@ -137,21 +137,17 @@ export async function createExport(input: CreateExportInput) {
|
||||
});
|
||||
const freshShot = await tx.shot.findUniqueOrThrow({
|
||||
where: { id: shot.id },
|
||||
select: { shotVersion: true, exrOutput: true },
|
||||
select: { shotVersion: true, exrOutput: true, slateVfxScope: true, slateSubmissionNote: true },
|
||||
});
|
||||
// Slate fields carry forward from the shot's previous submission
|
||||
// unless the caller supplies new ones.
|
||||
const previous = await tx.export.findFirst({
|
||||
where: { shotId: shot.id },
|
||||
orderBy: { versionNumber: "desc" },
|
||||
select: { vfxScope: true, submissionNote: true },
|
||||
});
|
||||
const vfxScope = input.vfxScope !== undefined ? input.vfxScope : (previous?.vfxScope ?? null);
|
||||
// vfxScope: caller override → shot's slate field
|
||||
const vfxScope = input.vfxScope !== undefined ? input.vfxScope : (freshShot.slateVfxScope ?? null);
|
||||
// submissionNote: caller override (per-export) → shot's slate default
|
||||
const submissionNote =
|
||||
input.submissionNote !== undefined ? input.submissionNote : (previous?.submissionNote ?? null);
|
||||
const versionNumber =
|
||||
Math.max(latest._max.versionNumber ?? 0, parseVersionString(freshShot.shotVersion)) + 1;
|
||||
const versionString = formatVersionString(versionNumber);
|
||||
input.submissionNote !== undefined ? input.submissionNote : (freshShot.slateSubmissionNote ?? null);
|
||||
// versionNumber is an internal sequence for DB uniqueness only; output files
|
||||
// use the shot's current (manually-set) shotVersion.
|
||||
const versionNumber = (latest._max.versionNumber ?? 0) + 1;
|
||||
const versionString = freshShot.shotVersion ?? formatVersionString(versionNumber);
|
||||
const exrBase = nextExrOutputBase(freshShot.exrOutput, shot.shotCode, versionString);
|
||||
|
||||
const outputDir =
|
||||
@@ -236,13 +232,6 @@ export async function createExport(input: CreateExportInput) {
|
||||
},
|
||||
});
|
||||
|
||||
// Mirror the legacy panel PATCH: Shot stays the canonical "current version"
|
||||
const updatedShot = await tx.shot.update({
|
||||
where: { id: shot.id },
|
||||
data: { shotVersion: versionString, exrOutput: exrBase },
|
||||
select: { id: true, shotVersion: true, exrOutput: true },
|
||||
});
|
||||
|
||||
return {
|
||||
export: {
|
||||
id: created.id,
|
||||
@@ -256,7 +245,7 @@ export async function createExport(input: CreateExportInput) {
|
||||
submissionNote,
|
||||
},
|
||||
renderJob: { id: renderJob.id, attempt: renderJob.attempt, priority: renderJob.priority },
|
||||
shot: updatedShot,
|
||||
shot: { id: shot.id, shotVersion: versionString, exrOutput: exrBase },
|
||||
superseded: toSupersede.map((s) => s.id),
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user