Commit Graph

340 Commits

Author SHA1 Message Date
xyx
70283d9dfe fix: enhance 401 error handling to exclude login requests 2026-07-13 14:22:22 +08:00
xyx
187e4f2af0 fix: improve error handling in expense form submissions 2026-07-13 12:16:39 +08:00
xyx
619b3b22bd fix: use saved dingtalk config for integration calls 2026-07-13 11:43:11 +08:00
b5ef91bf2d fix: support Windows dev startup 2026-07-13 10:35:43 +08:00
1c8bd08be4 feat: settle course attendance automatically 2026-07-13 10:26:38 +08:00
b9b295c997 refactor: remove unused classroom fields 2026-07-13 09:34:15 +08:00
a266d450e1 chore: apply eslint --fix autofixes (remove unnecessary as never casts in tests) 2026-07-12 23:01:37 +08:00
b5f4b8747c fix: schedules lookups test mock missing classroomRepo constructor arg
The SchedulesService constructor expects 5 repository arguments.
The test only provided 4, passing {} as never for classroomRepo.
Added classroomRepo mock with find() returning full selected columns.

Fixes: schedules.lookups.spec.ts — 'returns scoped classes and
minimal classrooms for schedule viewers'
2026-07-12 23:01:00 +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
b6fca99390 fix: align permission navigation and page access 2026-07-11 14:55:49 +08:00
1e1c476bc3 feat: add CASL authorization and AI configuration 2026-07-11 14:25:34 +08:00
8f0991a51f feat: replace tenants with organization management 2026-07-10 21:27:26 +08:00
8ed1682b90 fix permissions and teacher attendance workflows 2026-07-10 20:40:52 +08:00
247879f276 docs: add CodeGraph repository guidance
Document the preferred CodeGraph-first workflow for locating and understanding indexed code.
2026-07-10 14:13:07 +08:00
44105c1689 refactor: remove obsolete scaffolding and dead modules
Drop the unused root hello-world controller, empty CommonModule imports, development seeding code, legacy student report entity, stale DTOs, notification hook, and their placeholder tests.
2026-07-10 14:12:56 +08:00
b093d69f6a fix(server): correct archive filters and deposit access
Parse archived class query flags without Boolean string coercion, register the refund approval permission, and grant dorm managers the deposit permission group.
2026-07-10 14:12:44 +08:00
50b3608db4 fix(admin): repair class, role, and room views
Use the RBAC user endpoint for teacher selection, restore role table columns, correct Ant Design props, and add typed room bed and locker responses.
2026-07-10 14:12:08 +08:00
e26a8e816e fix(attendance): normalize DingTalk match statuses
Store and validate stable English status codes for unmatched, pending, and matched attendance records so import, filtering, and auto-match use the same values.
2026-07-10 14:11:55 +08:00
1ca4a4d185 fix(archive): serve student attachments securely
Download attachments through authenticated API requests, support configurable upload paths, validate resolved file locations, and retain compatibility with legacy stored paths.
2026-07-10 14:11:47 +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
bc6b8b0095 fix: 修复入住管理白屏、重构首页工作台、拍平教务菜单
- Occupancies: 补齐缺失的 Alert import(渲染时 ReferenceError 导致白屏),
  并为两处 api.get 补泛型消除既有类型错误
- Dashboard: 改为待办优先的工作台(待办异常区 + 核心 KPI + 更多指标折叠 +
  图表按重要性重排),修复 fetchData 无限请求循环(loadedRef),
  重活图表用 IntersectionObserver(callback ref)懒加载
- MainLayout: 将三层嵌套的"教室管理"提升为一级菜单,全站菜单统一为两层
2026-07-10 11:16:30 +08:00
f6a84fd6b3 fix: assign each user to single leaf dept to prevent duplicates 2026-07-10 10:09:47 +08:00
fb54a6c466 fix: assign users to leaf departments only, handle multi-branch dept chains 2026-07-10 10:08:07 +08:00
3ccb878092 fix: fetch users from all sub-departments in syncAll and fetchOrgTreeWithUsers 2026-07-10 10:06:35 +08:00
3992f6c33f feat: implement fetchOrgTree and fetchOrgTreeWithUsers via dingtalk API 2026-07-10 10:04:59 +08:00
18060d44a8 fix: pass user name and mobile to backend when importing students 2026-07-10 09:50:45 +08:00
31bcd15189 fix: use real name and phone from frontend when importing students 2026-07-10 09:50:18 +08:00
b261ec5930 feat: change dingUserIds to users array with name/mobile in DTOs 2026-07-10 09:49:41 +08:00
1f9308c1b7 plan: fix student import name/phone from dingtalk 2026-07-10 09:47:26 +08:00
e7e335cd95 spec: fix student import name/phone from dingtalk 2026-07-10 09:45:43 +08:00
97c2ceccde fix: re-apply UX fixes on Bills, Expenses, Deposits
- Add Empty component to antd imports
- Replace console.error with message.error in catch blocks
- Add batchLoading state + guard on batch operations
- Add locale emptyText to Tables
2026-07-09 19:57:10 +08:00
8f28c172c4 fix: close unclosed fragments in Expenses/Deposits, fix brace in Bills 2026-07-09 19:52:33 +08:00
bc2ff2b270 fix: brace mismatch in Classes fetchData try/catch/finally 2026-07-09 19:49:21 +08:00
c59fd6ce92 fix(admin): UX improvements — silent fetch failures, empty states, batch loading guards, dashboard refresh
- Replace console.error-only catches with message.error user-facing notifications
  across Bills, Classes, ClassroomRentals, ClassroomSchedule, Classrooms, Deposits,
  Expenses, OperationLogs, Permissions, Roles, RoomVisual, Rooms, Students,
  Tenants, Users
- Add Empty component via Table locale prop on list pages: Bills, Classes,
  ClassroomRentals, Classrooms, Deposits, Expenses (room+personal), Occupancies,
  Rooms, Students, Tenants, Roles
- Add batchLoading state to batch delete/update operations: Bills (batchDelete,
  batchUpdateStatus), Expenses (batchDeleteRoom, batchDeletePersonal),
  Occupancies (batchCheckOut, batchDelete), Rooms (batchDelete),
  Students (batchDelete)
- Add refreshLoading indicator to Dashboard header when re-fetching data
- Consistent error pattern: catch (e: unknown) { const err = e as { message?: string }; message.error(...); }
2026-07-09 18:03:42 +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
b0f7883f33 feat(admin): remove all department/campus scoping from frontend
- Delete CampusSwitcher component and useCampus hook
- Delete Departments page and its route
- Remove campus header interceptor from API client
- Remove departmentId from Class interfaces
- Remove campusLocation from student profile
- Remove department permissions from test fixtures
- Remove currentCampusId from test cleanup

TypeScript compiles clean.
2026-07-09 17:40:57 +08:00
22bc1876d8 refactor: remove departmentId from Class entity 2026-07-09 17:32:37 +08:00
40fef906cd fix: resolve DingTalk dept ID to local department ID in class create 2026-07-09 17:28:12 +08:00
9b7a8e37b4 fix: resolve 5 review findings
Critical 1: Remove broken '钉钉绑定' tab (IntegConfig) — deleted /rbac/user-ding-mappings calls
Critical 2: Fix decorator placement in CreateClassDto — @IsOptional @IsArray restored to teachers
Important 1: Restore sync.service.spec.ts from 1fa3363, strip importDingTalkUsers tests
Important 2: Fix N+1 in batchImportStudents — batched find/save with In() operator
Important 3: Add migrate-student-ding-mapping.sql
2026-07-09 17:25:44 +08:00
1f63a53222 feat: rewrite sync drawer with checkable tree + class batch import 2026-07-09 17:16:08 +08:00
91035e9f2c feat: add batch-import students to class endpoint 2026-07-09 17:12:23 +08:00
7b8691866e refactor: remove User-based import and RBAC UserDingMapping endpoints 2026-07-09 17:10:33 +08:00
570ef7b7e9 revert: remove deepest-2-levels filter, restore full org tree 2026-07-09 17:07:22 +08:00
e87e5e2096 refactor: syncAll creates Student + StudentDingMapping directly 2026-07-09 17:05:54 +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
1fa336331c docs: student ding mapping + batch operations implementation plan 2026-07-09 16:49:38 +08:00
6762a7f661 docs: student ding mapping + drawer batch operations spec 2026-07-09 16:46:32 +08:00
c1d065a5e6 fix(students): remove staff role from status map 2026-07-09 16:32:02 +08:00