ProductTeachers

Teachers

One-line: Manage teacher profiles, their subject and class assignments, leave, and timetable availability — each teacher gets a real login account.

What it does

The Teachers module is the staff-side counterpart to Students. It holds each teacher’s profile and HR details, tracks which subjects and classes they teach, runs a lightweight leave workflow with balances, and captures the availability and workload limits the timetable generator needs when it schedules periods. Every teacher is created with a login account, so the same record powers both admin management and the teacher’s own mobile self-view.

Who uses it

  • School admin / office staff — create teacher records, assign subjects and classes, approve or reject leave, and set availability and workload rules.
  • Teachers — view their own profile, today’s schedule, assigned classes, and leave balance, and apply for or cancel leave, mostly from the mobile app.

Key concepts

  • Teacher record — profile plus HR fields (employee_id unique per school, department, qualification, designation, joining_date), linked to a users login account.
  • Subject assignment — the subjects a teacher teaches and the classes they are attached to, surfaced on the teacher object as subjects and classes.
  • Leave management — leave requests (sick, casual, earned) that move pending → approved / rejected, drawn against an annual per-type balance.
  • Availability — a per-teacher, per-period grid marking which day/period slots the teacher can be scheduled in.
  • Workload rules — max periods per day and per week the timetable generator must respect.

How it works

CRUD           create/read/update/delete teachers (create also provisions the login + 'teacher' role)
Subjects       assign subjects and classes; shown on the teacher profile
Leaves         teacher applies → admin approves/rejects → approved leave deducts from balance
Availability   admin blocks specific day/period slots the teacher can't be scheduled
Workload       admin sets max periods/day and /week; timetable generator honours them

Teacher create and update run field validation (name, email format, phone, experience_years 0–80, string length caps). Leave balances expose total, used, and remaining days per leave type.

Rules & edge cases

  • Plan gated. The module requires the teacher_management plan feature; permissions use the teacher.* prefix.
  • Tenant scoped. All data is isolated per school (tenant), and employee_id uniqueness is per tenant.
  • Delete = soft-deactivate. Deleting a teacher removes the teacher row but soft-deactivates the backing users login (deleted_at) rather than hard-deleting it — no orphaned login remains, and attendance history is preserved.
  • Leave and workload logic exist but depend on the timetable generator to enforce availability/workload during scheduling.

Where it lives

  • Backend: server/modules/teachers/ (API prefix /api/teachers)
  • Admin web: teacher management pages via admin-web/src/services/teachersService.ts
  • Mobile: teacher self-view under client/modules/teachers/
  • Plan feature key: teacher_management