feat(uploads): P0-1 batch 4 — server-side duplicate photo detection (409 + force + index)

契约 UploadInitRequest 加 force(bool,仅 owner/admin 跳过查重)。
服务端 init 事务前置查重:同 albumId + uploaderId + bytes 的非 deleted
照片已存在 → 409 PHOTO_DUPLICATE。photos 表加 idx_photos_dedup 索引
(迁移 20260928120000)。
App UploadInitRequest 加 force 字段 + toJson 序列化。
本地查重(层 1)+ 服务端查重(层 2)双层防线到位。

API typecheck ✅ · app analyze ✅ · 397/397 ✅ · contract lint ✅

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-28 11:29:29 +08:00
parent 33f347cdea
commit 90dcc58c33
7 changed files with 74 additions and 18 deletions
+7
View File
@@ -1648,6 +1648,13 @@ export interface components {
* (A19)。可选;同一 clientTaskId 幂等重放时保留首次落库的值。
*/
sourceDeviceId?: string;
/**
* @description 跳过服务端查重(P0-1 层 2)。仅相册 owner/admin 可用;协作者
* 传 true 无效。false(缺省)时:同 albumId+uploaderId+bytes
* 已有非 deleted 照片 → 409 PHOTO_DUPLICATE。
* @default false
*/
force: boolean;
};
/** @description staging 对象的临时直传凭证;仅可写入指定 objectKey,不可访问 originals/variants。 */
UploadCredential: {