Add full editing for client proofing links
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user