Derived from role.schema.ts:8-65 (system roles), users/schemas/user.schema.ts:14-79,
and the leave service semantics (leave.service.ts). Behaviors that the API
enforces are cited; anything else is product expectation (proposed).
Only pending can be decided (leave.service.ts:175-178); cannot approve own request (:179-180); approval blocked at 409 if balance insufficient (:188-189)
Frustrations
Self-approval impossible by design (must delegate); no batch decisions; no leave-type edit/delete
Success metric (proposed)
Approvals resolved same-day; substitution assigned within 24 h of approval for multi-day leave
teacher with a Teacher record (teacherRepo.findOne, leave.service.ts:232-238)
Context
Covers classes for absent teachers; paid per covered slot
Key actions
View assigned substitutions: GET /leave/substitutions/teacher/:id (leave.controller.ts:79-83) — list sorted by date ascending (leave.service.ts:275-280)
API constraints
Admin assigns; substitute does not accept/decline (no endpoint); slot clash is rejected at assignment time (leave.service.ts:241-250)
Frustrations
No accept/decline flow; no conflict visibility beyond admin checks; substitution status is stuck at assigned (no completed/cancelled transition in service)
Success metric (proposed)
Substitution discovery < 30 s after open; no-show rate tracked via Timetable (planned, IMPLEMENTATION_PLAN.md:163)
Office staff; needs casual/sick leave like teachers; no substitution mechanics apply (no Teacher record → 404 on substitution, leave.service.ts:232-238)
Key actions
Request leave; check balance; track status — same endpoints as Teacher
Note
Any authenticated user can create a request (userId from tenant context, leave.service.ts:138); nothing in code restricts leave to staff/teachers (gap: student/parent roles are not excluded)