feat(03-05): technician service, compensation service, APIs, and 27 passing tests

- technician-service.ts: createTechnicianProfile, updateTechnicianProfile, getTechnicianProfile, getTechnicianProfileByUserId, listTechnicians
- compensation-service.ts: getCompensationSummary (all 3 models), getTechnicianCompensationDetail (job-by-job)
- 6 API routes: GET/POST /api/technicians, GET/PUT /api/technicians/[id], GET /api/technicians/[id]/compensation, GET/POST /api/job-type-rates, PUT /api/job-type-rates/[id], GET /api/reports/compensation
- Added TechnicianProfile and JobTypeRate to CASL AppSubjects; OFFICE_STAFF read access
- 27 integration tests: all 3 models, missing rate defaults to 0, only COMPLETED count, date range filter, summary+detail reports, cross-tenant isolation — all green
This commit is contained in:
kevin-asprec
2026-03-05 08:17:03 +08:00
parent 230b0ec683
commit fba2ba4bf9
11 changed files with 2001 additions and 0 deletions

View File

@@ -57,6 +57,11 @@ export function definePermissionsFor(
can("manage", "Ticket");
// Job order management
can("manage", "JobOrder");
// Technician profile management (read/update, not create — admin only for compensation config)
can("read", "TechnicianProfile");
can("update", "TechnicianProfile");
// Job type rates (read-only for office staff — admin configures rates)
can("read", "JobTypeRate");
// View financial reports (read-only)
can("read", "Report");
// View accounting (read-only, cannot modify Chart of Accounts)