feat(sync): 对账清单 ad 实体当前态清扫

Task 8(ads-carousel):cn reconcile 增 entityType='ad' 分支——纯 SELECT
当前态映射(sortOrder/createdAt 确定性排序,albumId 恒空串信封约定),
载荷复用 ads/ad-payload.ts 单一出处(与业务事务内即时事件逐字节同形,
纯函数模块无依赖环);DTO SYNC_ENTITY_TYPES 追加 'ad'(对齐契约 enum)。

随附质量审查两项:
- ads.service list() 行→AdminAdItem 映射复用 toItem(删 ~14 行内联重复,
  ⑮ 补 admin list 200 形状断言覆盖重构路径);
- 新增 test/ads-extensions.spec.ts 守护 AD_IMAGE_EXTENSIONS ===
  UPLOAD_CONTENT_TYPES 派生归一扩展名集合(jpeg→jpg),防三处白名单漂移。

测试基建:reset.ts RESET_TABLES 补 'ads'(Task 6 建表遗漏,固定 id 直种
依赖跨 spec 清场);reconcile.e2e-spec 追加 ⑤(红→绿,5/5)。

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-29 00:22:13 +08:00
parent 4979091d2c
commit 60b675a908
8 changed files with 256 additions and 38 deletions
+3
View File
@@ -24,6 +24,9 @@ export const RESET_TABLES: readonly string[] = [
// 照片与上传域 + outbox(Task 10):均为扁平字符串外键(无 FK 约束),
// 顺序按逻辑依赖排列(事件/作业/变体/会话先于 photos)。
'outbox_events',
// 广告位域(ads-carousel Task 6):扁平表无 FK;e2e 直种固定 id 行 +
// reconcile 清单计数断言依赖跨 spec 清场(此前 cuid id 未见残留冲突)。
'ads',
// 展示位域(P4b Task 2):授权成员表先于展示位(建而未用,P5 激活)。
'embed_slot_members',
'embed_slots',