feat(游戏共创): 收录(收藏)契约与文档同步(块 3/3)
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust crates (pull_request) Has been cancelled
Project CI / Backend tests (pull_request) Has been cancelled
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust crates (pull_request) Has been cancelled
Project CI / Backend tests (pull_request) Has been cancelled
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Has been cancelled
- `shared-contracts`:新增 `GameDistributionCollectionState { collected, replayed: Option<bool> }` 承载 PUT/DELETE 共用形状(PUT 才发 `replayed`);既有 `GameDistributionGameSummary` 增 `collected: Option<bool>`(公开详情登录时才带)——该类型只被 api-server 测试与 `GameDistributionListResponse` 引用,加字段不影响任何现有发送方
- `packages/shared` TS 镜像同步(`{ collected: boolean; replayed?: boolean }` 与 `GameDistributionGame.collected?: boolean`),并按既有约定登记进 `scripts/check-game-distribution-dto-parity.mjs`(PAIRS + 手拼响应构建器);注意 `json!` 字面量里不插注释行(parity 脚本抓顶层键时不剥注释,这个坑今天踩过一次)
- 技术方案:`§2.4` 入口矩阵补「收藏按钮 / 我的收藏(登录)与我的作品页同行风格」;`§3.4` 接口表补三条路由(含 404/409 语义、PUT 要求幂等键而 DELETE 不要求及理由、`my-collections` 只含公开作品且不删行)与公开详情 `collected` 的可见性口径;`§7` 把「收录/收藏」从范围外移除并标注已纳入落地
- 数据契约表目录:新增 `game_distribution_collection` 小节(主键确定性、两个索引、为什么不删行、为什么不建唯一索引),供 `check:spacetime-schema` 守卫通过(94 tables)
- 门禁:DTO parity 0(**49 组** Rust/TS 一致,较本轮前 +7);`check:spacetime-schema` 0(94 tables,对照新 merge-base `51cb05f4`);`check:encoding` 0;`git diff --check` 0
This commit is contained in:
@@ -80,6 +80,8 @@ const PAIRS = [
|
||||
'GameDistributionSetForkAuthorizationRequest',
|
||||
'GameDistributionSetForkAuthorizationRequest',
|
||||
],
|
||||
// 收藏(收录):PUT / DELETE 共用同一个权威投影值形状(`replayed` 只有 PUT 会发)。
|
||||
['GameDistributionCollectionState', 'GameDistributionCollectionState'],
|
||||
['AdminGameReviewGamesQuery', 'AdminGameReviewGamesQuery'],
|
||||
['AdminGameReviewGame', 'AdminGameReviewGame'],
|
||||
['AdminGameReviewGamesResponse', 'AdminGameReviewGamesResponse'],
|
||||
@@ -129,8 +131,22 @@ const RESPONSE_BUILDERS = [
|
||||
base: 'game_payload',
|
||||
mustEmit: ['currentVersion', 'ratingSummary', 'forkCount', 'lineage'],
|
||||
},
|
||||
{
|
||||
// 公开详情在 `public_game_payload` 之上按**可选登录态**追加 `collected`;匿名请求不加键,
|
||||
// 因此它不能进 `mustEmit`(那条路径本来就不发),但必须是一个真实构建器:
|
||||
// 这层证据说明「登录时确实会发出 `collected`」,而不是只写在 DTO 注释里。
|
||||
fn: 'public_game_detail_payload',
|
||||
ts: 'GameDistributionGame',
|
||||
base: 'public_game_payload',
|
||||
},
|
||||
{ fn: 'private_version_payload', ts: 'GameDistributionPrivateVersion' },
|
||||
{ fn: 'version_summary_payload', ts: 'GameDistributionVersionSummary' },
|
||||
{
|
||||
// 「我的收藏」复用公开目录的分页字段与条目形状;游标恒为 null(收藏量受用户自身规模约束)。
|
||||
fn: 'my_collections_payload',
|
||||
ts: 'GameDistributionListResponse',
|
||||
mustEmit: ['games', 'nextCursor'],
|
||||
},
|
||||
];
|
||||
|
||||
function camelCase(value) {
|
||||
|
||||
Reference in New Issue
Block a user