furniture-3d-system-Wu/furniture-3d-system/docs/solutions/workflow-issues/panel-route-service-permission-unification-20260215.md
WuYongJie 5821d73291 初始提交:3D家具安装展示系统
包含:
- furniture-3d-system:Next.js 16 全栈应用(资产中心、产品管理、3D装配动画)
- autocad-plugin:AutoCAD 家具导出插件源码
- 资产中心改造:编辑弹窗化、删除功能、Toast反馈、自定义Select组件

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 14:00:19 +08:00

1.2 KiB
Raw Blame History

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
产品板件路由权限收口到 Service 2026-02-15 panel-route workflow_issue high
Route 与 Service 同时维护产品权限判断
Route 直连 Prisma,权限策略容易漂移
分层迁移不彻底,Controller 仍承担数据访问与业务判断 code_fix active high
architecture
route-service
panel
WF-HOLE-ROUTE-SERVICE-001

现象与影响

products/[id]/panels 在 Route 层重复做查询和权限,Service 也有权限逻辑,导致规则双轨并行。

修复动作

  1. src/app/api/products/[id]/panels/route.ts 移除 Prisma 和 canView/canEdit 分支。
  2. src/server/services/panel.service.ts 的 findByProductId 接入权限校验(ctx.user 存在时执行 canViewProduct)。
  3. Route 仅保留参数解析、调用 Service 与统一响应。

验证

  • npm run type-check -- --pretty false 通过
  • npm test -- tests/api/auth-me.test.ts --runInBand 通过

预防策略

  • Route 层只做入口编排;权限与业务判断统一放在 Service 层,避免策略漂移。