包含: - furniture-3d-system:Next.js 16 全栈应用(资产中心、产品管理、3D装配动画) - autocad-plugin:AutoCAD 家具导出插件源码 - 资产中心改造:编辑弹窗化、删除功能、Toast反馈、自定义Select组件 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1.5 KiB
1.5 KiB
title, date, module, problem_type, severity, symptoms, root_cause, resolution_type, status, confidence, tags, related_patterns
| title | date | module | problem_type | severity | symptoms | root_cause | resolution_type | status | confidence | tags | related_patterns | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Hole Route 去 Repository 直连并收口到 Service | 2026-02-15 | holes-route | workflow_issue | high |
|
历史实现为了快速交付在 Route 层叠加了数据访问与业务编排 | code_fix | active | high |
|
|
现象与影响
/api/holes 同时承担参数解析、数据访问、业务编排,导致:
- 违反
Route -> Service -> Repository分层约束。 - 相同规则(筛选、删除限额、权限)难以复用,后续接口容易漂移。
修复动作
src/app/api/holes/route.ts移除holeRepository/panelRepository直连。- 新增
holeService.listByFilter与holeService.deleteByFilter,将筛选、权限、数量校验与删除编排统一下沉到 Service。 - Route 仅保留参数解析、输入校验与统一响应封装。
验证
npm run type-check -- --pretty false通过npm test -- tests/lib/cad-panel-linking.test.ts --runInBand通过
预防策略
- 新增 API 时先定义 Service 方法,再编写 Route;Route 不允许直接引入 Repository。
- Code Review 对 Route 层增加规则:若出现
*Repository依赖需给出例外说明,否则驳回。