refactor: fix remaining P2 architecture issues
Fix P2-6: proxy.ts now uses Permissions constants instead of hardcoded strings Fix P2-7: useA11yId file no longer exists (use-aria-live.ts already in hooks/) Fix P2-8: schema.ts section numbering reordered to continuous 1-24 Fix P2-11: announcements dead code void wasPublished already removed Fix P2-17: app-sidebar.tsx uses hasRole() instead of permission-based role inference Fix P2-18: scheduling/actions.ts removes trailing re-export of data-access; 4 pages now import directly from data-access Sync architecture docs 004 and 005
This commit is contained in:
@@ -1410,19 +1410,19 @@ shared/lib/{audit-logger, change-logger, auth-guard} → @/auth → shared/lib/*
|
||||
| ~~P2-3~~ | ~~`shared/lib/ai.ts` 218 行,混合 5 类职责~~ ✅ 已修复(P2-2 已拆分为 `ai/` 目录) | shared |
|
||||
| P2-4 | `onboarding-gate.tsx` 业务逻辑泄漏到 shared | shared |
|
||||
| P2-5 | `global-search.tsx` 业务类型硬编码在 shared | shared |
|
||||
| P2-6 | `proxy.ts` 硬编码权限字符串,未复用 Permissions 常量 | proxy |
|
||||
| P2-7 | `useA11yId` Hook 错放在 lib/ 而非 hooks/ | shared |
|
||||
| P2-8 | `schema.ts` 分节编号混乱(section 12 出现在 14b 之后) | shared/db |
|
||||
| ~~P2-6~~ | ~~`proxy.ts` 硬编码权限字符串,未复用 Permissions 常量~~ ✅ 已修复(改用 `Permissions` 常量) | proxy |
|
||||
| ~~P2-7~~ | ~~`useA11yId` Hook 错放在 lib/ 而非 hooks/~~ ✅ 已修复(文件已不存在;`use-aria-live.ts` 已在 `hooks/` 目录) | shared |
|
||||
| ~~P2-8~~ | ~~`schema.ts` 分节编号混乱(section 12 出现在 14b 之后)~~ ✅ 已修复(重新编号为连续 1-24) | shared/db |
|
||||
| P2-9 | `audit/actions.ts` Excel 导出逻辑内联 | audit |
|
||||
| P2-10 | school 模块审计日志不一致(仅 school 实体记录) | school |
|
||||
| P2-11 | `announcements` 死代码 `void wasPublished` | announcements |
|
||||
| ~~P2-11~~ | ~~`announcements` 死代码 `void wasPublished`~~ ✅ 已修复(代码中已不存在) | announcements |
|
||||
| ~~P2-12~~ | ~~`announcements` 权限模式不一致(requireAuth vs requirePermission)~~ ✅ 已修复 | announcements |
|
||||
| P2-13 | `files` try-catch 吞错误 | files |
|
||||
| P2-14 | `elective` runLottery 使用 Math.random | elective |
|
||||
| P2-15 | `elective` selectCourse FCFS 并发超卖风险 | elective |
|
||||
| P2-16 | `diagnostic` 班级报告 studentId 字段复用 | diagnostic |
|
||||
| P2-17 | `layout` 用权限反推角色 | layout |
|
||||
| P2-18 | `scheduling/actions.ts` 末尾 re-export data-access | scheduling |
|
||||
| ~~P2-17~~ | ~~`layout` 用权限反推角色~~ ✅ 已修复(`app-sidebar.tsx` 改用 `hasRole()` 判断角色) | layout |
|
||||
| ~~P2-18~~ | ~~`scheduling/actions.ts` 末尾 re-export data-access~~ ✅ 已修复(移除 re-export,4 个页面改为从 `data-access` 导入) | scheduling |
|
||||
| P2-19 | `ExamAssembly` / `ExamPreviewQuestionEditor` 10 个 props | exams |
|
||||
| P2-20 | ~~`homework/data-access.getDemoStudentUser` 使用 `auth()` 而非 auth-guard~~ ✅ 已修复(已迁移至 `users/data-access.getCurrentStudentUser`,6 个 student 页面改用 users 模块;`elective` 页面改用 `getAuthContext()`;homework 保留 re-export 向后兼容) | homework |
|
||||
|
||||
@@ -1449,11 +1449,11 @@ shared/lib/{audit-logger, change-logger, auth-guard} → @/auth → shared/lib/*
|
||||
|
||||
### 中期执行(P2)
|
||||
14. ~~建立模块间数据访问规范(通过对方 data-access 或导出查询函数)~~ ✅ 已完成(P1-1 修复)
|
||||
15. `schema.ts` 按业务域分节
|
||||
15. ~~`schema.ts` 按业务域分节~~ ✅ 已完成(P2-8 修复:重新编号为连续 1-24,消除 8b/14b/乱序问题)
|
||||
16. 拆分 `exams/ai-pipeline.ts`
|
||||
17. ~~拆分 `shared/lib/ai.ts`~~ ✅ 已完成(P2-2,commit 6588f74,拆分为 `ai/` 目录 6 个文件,原 ai.ts 保留为重导出)
|
||||
18. shared 层业务逻辑下沉到 modules 层
|
||||
19. 代码质量问题逐项修复(✅ 大部分已修复:React.cache 包装、Promise.all 并行化、错误吞没清理、非空断言清理、函数返回类型补齐、重复代码提取、合并 filter 遍历、Set/Map 优化)
|
||||
19. 代码质量问题逐项修复(✅ 大部分已修复:React.cache 包装、Promise.all 并行化、错误吞没清理、非空断言清理、函数返回类型补齐、重复代码提取、合并 filter 遍历、Set/Map 优化、P2-6 proxy.ts 权限常量复用、P2-11 announcements 死代码清理、P2-17 layout 角色判断、P2-18 scheduling re-export 移除)
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user