f50301148d
fix(correctness): 并发/事务/实体/时区/状态一致性修复
...
由 OCR(open-codereview.ai,deepseek-v4-flash)审查驱动修复:
- wallets 原子扣款防 double-spend;refund 条件更新幂等;findTransactions 分页
- financial/imports/occupancies/attendance 事务与 advisory lock;重复生成/提交幂等
- 矛盾校验器、日期区间、实体双映射/DECIMAL/nullable、时区统一(china-time)
- rbac-seed 防重激活、exam 权限恢复、状态一致性、路由顺序、N+1/IN 分块等性能项
Reviewed-by: OCR (open-codereview.ai)
2026-08-09 21:29:54 +08:00
7905f1ee23
fix(server): 业务日期'今天'统一为中国日期,避免凌晨 UTC 偏一天
...
joinDate/leaveDate/checkInDate/sync 起始日等业务日期默认值原来用
dayjs().utc()(UTC 今天),在国内 00:00-07:59 会取到昨天。
统一改为 dayjs().utcOffset(8)(固定 UTC+8 中国日期),与考勤周边界
修复保持一致;pending-tasks/controller-base 的本地 dayjs() 也显式化。
2026-08-08 17:58:16 +08:00
8936453e84
refactor(server): 日期/月份格式化统一改用 dayjs
...
- 替换散落的 toISOString().slice(0,10) / split('T')[0] / replace('T',' ')(UTC 语义用 dayjs(...).utc() 保持完全一致)
- Asia/Shanghai 固定时区日期(Intl.DateTimeFormat en-CA)改用 dayjs().utcOffset(8)
- 月份边界 first/last、daysInMonth、nextMonth、shiftDate/addDays 等改 dayjs 简洁实现
- 涉及 attendance/classes/classrooms/room/dashboard/bills/expenses/occupancies/sync/ai-chat/rental 等 28 个文件
2026-08-08 17:52:32 +08:00
fd39e1686a
feat: 重构各业务模块管理页面与服务
2026-08-05 17:12:00 +08:00
b1f35f9d1a
test: harden business boundary conditions
2026-07-15 00:03:55 +08:00
e45da7f998
feat: improve attendance scheduling and API validation
2026-07-14 23:12:14 +08:00
cc4f4dae4e
fix: audit remediation — SSE user scoping, FK transactional safety, UI error handling
...
- H4: scoped SSE import progress to exact userId match; non-HTTP events excluded from all subscribers
- H2: moved PRAGMA foreign_key_check inside SQLite transaction before COMMIT; violations rollback preserving old tables
- M1: removed dead axios-style error branch from extractErrorMessage (interceptor already unwraps)
- M2: split handleSave try/catch — save errors vs reload errors shown distinctly
- M3: added provider field validation before AI config test request
- Added SSE scoping regression tests (import service + controller)
- Added FK check failure rollback test (database-migrations.spec)
- Updated controller spec expectations for userId parameter
Co-authored-by: Code Review <branch-review>
2026-07-12 22:59:03 +08:00
8ed1682b90
fix permissions and teacher attendance workflows
2026-07-10 20:40:52 +08:00
55881863c1
feat(sync): sync class schedules to DingTalk students
...
Group active schedules by class, resolve enrolled students through DingTalk mappings, reuse shifts and attendance groups, and expose class-based sync status in the admin UI.
2026-07-10 14:11:39 +08:00
6029d8e2fd
refactor(server): remove Department/UserDepartment entities, CampusScope, and departmentId from all entities
...
- Delete department.entity.ts, user-department.entity.ts
- Remove Department/UserDepartment from entities/index.ts
- Remove departmentId column from 18 entities (AttendanceRecord, ArchiveAttachment, Bill, ClassSchedule, Classroom, ClassroomRental, Deposit, DepositInstallment, ExamScore, LearningRecord, Occupancy, PersonalExpense, ResultArchive, Room, RoomExpense, Student, StudentEnrollment, StudentProfile, StudentReport)
- Remove departments/ module entirely
- Delete campus-scope.ts, campus-scope.middleware.ts (request-utils.ts kept — it's just IP extraction)
- Simplify common.module.ts to empty module
- Remove CampusScopeMiddleware from app.module.ts
- Remove all CampusScope injections and filter calls across all services
- Remove departmentId from all DTOs and controllers
- Simplify dingtalk/wecom sync to only sync users (no dept table)
- Update seed module to remove department seeding
- Clean frontend compilation
2026-07-09 17:51:32 +08:00
73c1ea7a76
fix: correct studentId-as-userId bugs in 3 files
...
- dingtalk.service.ts syncOneUser: find Student by userId before mapping,
use Student.id (not User.id) as studentId FK
- sync.service.ts importDingTalkUsers: type coercion for studentId
(method deleted in Task 4, minimal compile fix)
- schedule-sync.service.ts getStatus: remove broken teacher mapping
query (teacher scheduling deprecated); hardcode mappedTeachers=0,
totalTeachers=0
2026-07-09 17:04:35 +08:00
86f126671c
fix: repair 5 sites where StudentDingMapping.studentId was misused as User FK
...
- dingtalk.service.ts syncOneUser: query studentRepo (not userRepo) by mapping.studentId
- sync.service.ts importDingTalkUsers: skip User role lookup for existing mappings
- attendance.service.ts autoMatchDingRecords: use studentId directly, remove second-hop query
- schedule-sync.service.ts syncAll: skip teacher mapping block (deprecated)
- rbac.service.ts getUnboundUsers: return [] (method deleted in Task 4)
2026-07-09 17:00:00 +08:00
ef1b46b9f4
refactor: replace UserDingMapping with StudentDingMapping entity
2026-07-09 16:53:25 +08:00
731f74e51a
refactor: remove scheduled cron sync, manual trigger only
2026-07-09 10:24:12 +08:00