feat(api): 完善家谱系统API客户端契约
- 实现家谱管理相关方法,包括创建、详情、概览、我的家谱和选项查询 - 添加家谱加入申请功能,支持申请、审核、取消和待审核列表操作 - 集成通知详情获取方法和通知ID安全验证机制 - 完善功德记录、谱文、相册、视频、祭祀活动的完整CRUD操作契约 - 实现家谱成员管理功能,包含成员列表、更新、移除和转让所有者操作 - 优化路径ID验证逻辑,拒绝不安全的数值ID并提供明确错误提示 - 更新测试用例以验证所有新增API方法的路径和请求体白名单机制
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
- `auditGenealogyJoinApply(genealogyId, applyId, body)`
|
||||
- `cancelGenealogyJoinApply(applyId)`
|
||||
|
||||
- [ ] **Step 1: 写失败的路径和 body 白名单测试**
|
||||
- [x] **Step 1: 写失败的路径和 body 白名单测试**
|
||||
|
||||
测试固定以下请求:
|
||||
|
||||
@@ -69,7 +69,7 @@ await client.auditGenealogyJoinApply(genealogyId, applyId, {
|
||||
- 审核 body 只保留 `status/auditRemark`。
|
||||
- 所有 path ID 拒绝不安全数字。
|
||||
|
||||
- [ ] **Step 2: 运行 RED**
|
||||
- [x] **Step 2: 运行 RED**
|
||||
|
||||
Run:
|
||||
|
||||
@@ -79,11 +79,11 @@ node --test --test-name-pattern "genealogy lifecycle" tests/api-client-contract.
|
||||
|
||||
Expected: FAIL,新方法尚不存在。
|
||||
|
||||
- [ ] **Step 3: 最小实现方法和白名单**
|
||||
- [x] **Step 3: 最小实现方法和白名单**
|
||||
|
||||
使用现有 `request()`、`pickDefined()` 和 `toRequiredPathId()`;不增加兼容别名或 APP fallback。
|
||||
|
||||
- [ ] **Step 4: 运行 GREEN**
|
||||
- [x] **Step 4: 运行 GREEN**
|
||||
|
||||
Run:
|
||||
|
||||
@@ -110,7 +110,7 @@ Expected: PASS。
|
||||
- `normalizeCreatedGenealogy(item)`
|
||||
- `buildCreatedGenealogyUrl(item)`
|
||||
|
||||
- [ ] **Step 1: 写失败的创建行为测试**
|
||||
- [x] **Step 1: 写失败的创建行为测试**
|
||||
|
||||
```js
|
||||
assert.deepEqual(GenealogyEntryPages.buildGenealogyCreateBody({
|
||||
@@ -141,7 +141,7 @@ assert.deepEqual(GenealogyEntryPages.buildGenealogyCreateBody({
|
||||
- 创建响应必须有稳定 `genealogyId`、谱名和姓氏。
|
||||
- 跳转地址只能由响应 ID 产生:`profile-family-home.html?genealogyId=...`。
|
||||
|
||||
- [ ] **Step 2: 运行 RED**
|
||||
- [x] **Step 2: 运行 RED**
|
||||
|
||||
Run:
|
||||
|
||||
@@ -151,11 +151,11 @@ node --test tests/genealogy-entry-pages.test.js
|
||||
|
||||
Expected: FAIL,纯函数不存在。
|
||||
|
||||
- [ ] **Step 3: 最小实现纯函数**
|
||||
- [x] **Step 3: 最小实现纯函数**
|
||||
|
||||
严格构造 `AppGenealogyCreateBody`,可选空值省略,不读取页面外字段。
|
||||
|
||||
- [ ] **Step 4: 运行 GREEN**
|
||||
- [x] **Step 4: 运行 GREEN**
|
||||
|
||||
Run:
|
||||
|
||||
@@ -182,7 +182,7 @@ Expected: PASS。
|
||||
- Consumes: Task 1 和 Task 2、`RegionPages`、`UploadPages`
|
||||
- Produces: `initGenealogyCreatePage()`
|
||||
|
||||
- [ ] **Step 1: 写失败的页面测试**
|
||||
- [x] **Step 1: 写失败的页面测试**
|
||||
|
||||
断言页面:
|
||||
|
||||
@@ -193,7 +193,7 @@ Expected: PASS。
|
||||
- 表单只包含后端创建 DTO 字段和地区选择辅助字段。
|
||||
- 创建按钮、状态区域和额度区域可由脚本控制。
|
||||
|
||||
- [ ] **Step 2: 运行 RED**
|
||||
- [x] **Step 2: 运行 RED**
|
||||
|
||||
Run:
|
||||
|
||||
@@ -203,7 +203,7 @@ node --test tests/genealogy-entry-pages.test.js tests/pending-pages.test.js test
|
||||
|
||||
Expected: FAIL,页面仍 pending 且缺上传/初始化行为。
|
||||
|
||||
- [ ] **Step 3: 实现页面初始化和提交**
|
||||
- [x] **Step 3: 实现页面初始化和提交**
|
||||
|
||||
初始化顺序:
|
||||
|
||||
@@ -218,7 +218,7 @@ Expected: FAIL,页面仍 pending 且缺上传/初始化行为。
|
||||
|
||||
401 清登录态;403 保留登录态;业务错误显示在表单状态区域。
|
||||
|
||||
- [ ] **Step 4: 运行 GREEN**
|
||||
- [x] **Step 4: 运行 GREEN**
|
||||
|
||||
Run:
|
||||
|
||||
@@ -237,11 +237,11 @@ Expected: PASS。
|
||||
- Modify: `docs/PC接口对接规划.md`
|
||||
- Modify: `docs/superpowers/plans/2026-07-29-genealogy-create-first-batch.md`
|
||||
|
||||
- [ ] **Step 1: 更新契约和阶段状态**
|
||||
- [x] **Step 1: 更新契约和阶段状态**
|
||||
|
||||
记录 `AppGenealogyCreateBody`、`AppGenealogyVo`、额度、权限、上传派生字段、加入申请 ApiClient 契约及仍未开放的加入 UI。
|
||||
|
||||
- [ ] **Step 2: 聚焦和全量验证**
|
||||
- [x] **Step 2: 聚焦和全量验证**
|
||||
|
||||
Run:
|
||||
|
||||
@@ -253,6 +253,6 @@ git -c safe.directory=D:/WorkSpace/Web/jiapu diff --check
|
||||
|
||||
Expected: 全部 PASS。
|
||||
|
||||
- [ ] **Step 3: 浏览器验证并报告**
|
||||
- [x] **Step 3: 浏览器验证并报告**
|
||||
|
||||
使用真实账号验证创建页登录态、额度、地区加载、无手填 ID、控制台错误和提交前校验。不得为测试消耗真实创建额度;除非用户明确授权,不执行最终创建写操作。
|
||||
|
||||
Reference in New Issue
Block a user