Sfoglia il codice sorgente

📝 docs(story-007.001): 添加自定义路由参考文件标注

- 在自定义路由处理任务(AC: 4.1)中添加参考文件标注:
  - 添加自定义路由文件参考:`user-module/src/routes/custom.routes.ts`
  - 添加自定义路由文件参考:`system-config-module/src/routes/custom/create-system-config.ts`
  - 为每个自定义路由端点添加具体的参考模式(createUserRoute、updateUserRoute、deleteUserRoute)
- 在路由层转换任务(AC: 4)中添加聚合路由参考:
  - 添加聚合路由参考文件:`system-config-module/src/routes/system-config.routes.ts`
  - 添加聚合模式说明:使用`.route()`聚合自定义路由和CRUD路由
- 添加创建CRUD路由文件任务:
  - 参考文件:`advertisements-module/src/routes/advertisements.ts`
  - 配置说明:设置`readOnly: true`,因为创建、更新、删除通过自定义路由处理
- 更新文件位置部分:
  - 区分主路由文件、自定义路由文件、CRUD路由文件
  - 为每个文件添加具体的参考文件和功能说明

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
yourname 1 mese fa
parent
commit
51a2ab16f0

+ 31 - 1
docs/stories/007.001.transplant-channel-management-module.story.md

@@ -83,28 +83,50 @@ Draft
   - [ ] 添加认证中间件集成
     - **参考**: `packages/auth-module/src/middleware/auth.middleware.ts`
   - [ ] 配置OpenAPI文档和参数验证
+  - [ ] 聚合自定义路由和CRUD路由
+    - **参考文件**: `packages/core-module/system-config-module/src/routes/system-config.routes.ts`
+    - **聚合模式**: 使用`new OpenAPIHono().route()`聚合多个路由实例
+    - **步骤**:
+      1. 创建`channel-custom.routes.ts`(自定义业务逻辑路由)
+      2. 创建`channel-crud.routes.ts`(使用`createCrudRoutes`生成的CRUD路由)
+      3. 在主路由文件中聚合两者:`.route('/', customRoutes).route('/', crudRoutes)`
 - [ ] 实现自定义路由处理(适配业务逻辑) (AC: 4.1)
+  - [ ] 创建自定义路由文件`src/routes/channel-custom.routes.ts`
+    - **参考文件**: `packages/core-module/user-module/src/routes/custom.routes.ts`
+    - **参考文件**: `packages/core-module/system-config-module/src/routes/custom/create-system-config.ts`
+    - **架构模式**: 使用`createRoute`定义路由,`OpenAPIHono`实例处理请求
   - [ ] 自定义`POST /createChannel`路由:处理布尔返回值
     - **返回格式**: 成功返回`{ success: true }`,失败返回`{ success: false, message: "渠道名称已存在" }`
     - **源逻辑**: `channel.controller.ts:11-14`,`channel.service.ts:14-37`
+    - **参考模式**: `user-module/custom.routes.ts:11-42`中的`createUserRoute`
   - [ ] 自定义`POST /deleteChannel`路由:处理布尔返回值
     - **返回格式**: 成功返回`{ success: true }`,失败返回`{ success: false }`
     - **源逻辑**: `channel.controller.ts:16-19`,`channel.service.ts:39-42`
+    - **参考模式**: `user-module/custom.routes.ts:89-118`中的`deleteUserRoute`
   - [ ] 自定义`POST /updateChannel`路由:处理布尔返回值
     - **返回格式**: 成功返回`{ success: true }`,失败返回`{ success: false, message: "渠道不存在或名称重复" }`
     - **源逻辑**: `channel.controller.ts:21-24`,`channel.service.ts:69-93`
+    - **参考模式**: `user-module/custom.routes.ts:44-87`中的`updateUserRoute`
   - [ ] 自定义`GET /getAllChannels`路由:处理分页参数和返回格式
     - **参数**: `skip`, `take`查询参数
     - **返回格式**: `{ data: Channel[], total: number }`
     - **源逻辑**: `channel.controller.ts:26-29`,`channel.service.ts:44-51`
+    - **参考模式**: 自定义分页查询路由,参考`system-config-module`中的查询模式
   - [ ] 自定义`GET /searchChannels`路由:处理搜索功能
     - **参数**: `name`(搜索关键词),`skip`, `take`(分页参数)
     - **返回格式**: `{ data: Channel[], total: number }`
     - **源逻辑**: `channel.controller.ts:31-34`,`channel.service.ts:53-63`
+    - **参考模式**: 自定义搜索路由,参考`shared-crud`中的搜索参数处理
   - [ ] 自定义`GET /getChannel/:id`路由:处理单个渠道查询
     - **参数**: `id`路径参数
     - **返回格式**: `Channel`对象或`null`
     - **源逻辑**: `channel.controller.ts:36-39`,`channel.service.ts:65-67`
+    - **参考模式**: `user-module/custom.routes.ts`中的参数验证和错误处理
+  - [ ] 创建CRUD路由文件`src/routes/channel-crud.routes.ts`
+    - **参考文件**: `packages/advertisements-module/src/routes/advertisements.ts`
+    - **架构**: 使用`createCrudRoutes`生成标准CRUD路由
+    - **配置**: 配置`entity`, `createSchema`, `updateSchema`, `getSchema`, `listSchema`, `searchFields`等参数
+    - **注意**: 设置`readOnly: true`,因为创建、更新、删除操作通过自定义路由处理
 - [ ] 完成验证系统转换:从class-validator DTO转换为Zod Schema (AC: 5)
   - [ ] 分析源DTO`allin_system-master/server/src/channel_info/channel.dto.ts`
     - **源文件**: `allin_system-master/server/src/channel_info/channel.dto.ts`
@@ -230,8 +252,16 @@ Draft
     - **参考文件**: `packages/advertisements-module/src/entities/advertisement.entity.ts`
   - **服务文件**: `src/services/channel.service.ts`
     - **参考文件**: `packages/advertisements-module/src/services/advertisement.service.ts`
-  - **路由文件**: `src/routes/channel.routes.ts`
+  - **主路由文件**: `src/routes/channel.routes.ts`
+    - **参考文件**: `packages/core-module/system-config-module/src/routes/system-config.routes.ts`
+    - **功能**: 聚合自定义路由和CRUD路由
+  - **自定义路由文件**: `src/routes/channel-custom.routes.ts`
+    - **参考文件**: `packages/core-module/user-module/src/routes/custom.routes.ts`
+    - **参考文件**: `packages/core-module/system-config-module/src/routes/custom/create-system-config.ts`
+    - **功能**: 处理自定义业务逻辑(布尔返回值、分页参数、搜索功能)
+  - **CRUD路由文件**: `src/routes/channel-crud.routes.ts`
     - **参考文件**: `packages/advertisements-module/src/routes/advertisements.ts`
+    - **功能**: 使用`createCrudRoutes`生成标准CRUD路由,设置`readOnly: true`
   - **Schema文件**: `src/schemas/channel.schema.ts`
     - **参考文件**: `packages/advertisements-module/src/schemas/advertisement.schema.ts`
   - **测试文件**: `tests/integration/channel.integration.test.ts`