Add full editing for client proofing links

This commit is contained in:
2026-10-04 18:16:03 +03:00
parent fe4c716aa8
commit 2e6f027b71
3 changed files with 245 additions and 3 deletions

View File

@@ -134,7 +134,6 @@ export const sessionInputSchema = z.object({
export type SessionInput = z.infer<typeof sessionInputSchema>;
export const sessionPatchSchema = sessionInputSchema
.omit({ albumId: true })
.partial()
.extend({
/** Unlock a submitted selection so the client can change it again. */
@@ -295,6 +294,18 @@ export async function updateSession(id: string, patch: SessionPatch): Promise<Pr
}
}
if (patch.albumId !== undefined && patch.albumId !== session.albumId) {
session.albumId = patch.albumId;
// Picks from the previous album are no longer meaningful.
session.selection = [];
delete session.updatedAt;
delete session.submittedAt;
// A changed album starts fresh from the client's perspective.
session.downloadsUsed = 0;
}
if (patch.clientName !== undefined) session.clientName = patch.clientName;
if (patch.download !== undefined) session.download = patch.download;
// `null` clears, `undefined` leaves alone.