包含: - furniture-3d-system:Next.js 16 全栈应用(资产中心、产品管理、3D装配动画) - autocad-plugin:AutoCAD 家具导出插件源码 - 资产中心改造:编辑弹窗化、删除功能、Toast反馈、自定义Select组件 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1.4 KiB
1.4 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 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product Hardware Route 分层收口到 Service/Repository | 2026-02-15 | product-hardware-route | workflow_issue | high |
|
历史实现未遵循 Route -> Service -> Repository 分层约束 | code_fix | active | high |
|
|
现象与影响
Route 层直接写 Prisma 会导致:
- 权限逻辑散落,重复实现容易漂移。
- 业务规则不可复用,后续接口扩展成本高。
- 架构审查难以确认边界是否一致。
修复动作
- 新增
product-hardware.repository.ts统一承接 ProductHardware 的查询/更新。 - 新增
product-hardware.service.ts统一承接权限校验、业务校验与编排。 src/app/api/product-hardware/[id]/route.ts仅保留参数校验和统一响应,不再直连 Prisma。
验证
npm run type-check -- --pretty false通过npm test -- tests/lib/cad-panel-linking.test.ts --runInBand通过
预防策略
- Route 文件出现
prisma.直接访问时,默认判定为架构违规。 - 新接口先设计 Service 方法和 Repository 原子方法,再接入 Route。