feat(worker): watermark versioning with atomic history regeneration

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-20 17:53:44 +08:00
parent 6723a0ce88
commit 243b2f8721
34 changed files with 3057 additions and 78 deletions
@@ -221,6 +221,13 @@ export class SyncInboxService {
const categorySnapshot = Array.isArray(p.categories)
? (p.categories as unknown as Prisma.InputJsonValue)
: undefined;
// P4a Task 3 水印副本位:旧事件/手写载荷可能缺字段——防御性归一(缺省=
// 关闭/0),语义上「缺水印位」与「水印关闭」同形。
const watermarkEnabled = p.watermarkEnabled === true;
const watermarkConfigVersion =
typeof p.watermarkConfigVersion === 'number' && p.watermarkConfigVersion > 0
? Math.floor(p.watermarkConfigVersion)
: 0;
await tx.albums_ov.upsert({
where: { albumId: event.entityId },
create: {
@@ -230,6 +237,8 @@ export class SyncInboxService {
publicEnabled: p.publicEnabled,
downloadEnabled: p.downloadEnabled,
originalDownloadEnabled: p.originalDownloadEnabled,
watermarkEnabled,
watermarkConfigVersion,
translations: p.translations as unknown as Prisma.InputJsonValue,
categories: categorySnapshot ?? [],
defaultLocale: p.defaultLocale,
@@ -244,6 +253,8 @@ export class SyncInboxService {
publicEnabled: p.publicEnabled,
downloadEnabled: p.downloadEnabled,
originalDownloadEnabled: p.originalDownloadEnabled,
watermarkEnabled,
watermarkConfigVersion,
translations: p.translations as unknown as Prisma.InputJsonValue,
...(categorySnapshot !== undefined
? { categories: categorySnapshot }