ProductClasses

Classes

One-line: Create and run each class section for the year — its students, its class-teacher, the subjects it studies, and who teaches them.

What it does

Classes is where a school builds its section structure for an academic year — sections like 10-A or 10-B, each tied to a grade, medium, programme, and (optionally) a school unit/branch. Each class holds a roster of enrolled students, a designated class-teacher, a set of subject-teacher assignments, and the subjects taught in it with periods per week. It is the anchor the rest of the system hangs off: attendance, timetable, and branch-scoping all reach a school through the class a student sits in.

Who uses it

  • Admins and academic coordinators — the admin-web Classes page (create sections, assign students/teachers, map subjects).
  • Branch-restricted sub-admins — same page, but limited to classes in their own school unit(s).
  • Teachers and students — consume the structure downstream (timetable, attendance, mobile app), not manage it.

Key concepts

  • Class (section) — one row per section per academic year (10-A), with capacity, grade, and academic-year links.
  • Class-teacher assignment — one teacher marked as the form/homeroom teacher (is_class_teacher); the same teacher can also appear for the subjects they teach.
  • Class-subject mapping — which subjects run in the class and their periods_per_week (stored via class_subjects).
  • Medium / programme / school-unit links — optional structural tags; the school-unit link makes the class the anchor for branch scoping.
  • Grade sequence — classes carry grade_sequence so lists order Nursery, LKG … 10 correctly instead of alphabetically.

How it works

Create section  → set name, grade, academic year, medium, capacity
Add students    → POST /<id>/students (capacity + tenant checked)
Assign teachers → POST /<id>/teachers (teacher + subject; one is class-teacher)
Map subjects    → per class, or bulk by grade (subjects/by-grade)
Roll to next yr → POST /classes/copy (copies teachers + subjects, NOT students)

Full CRUD is available on /api/classes (class.read / create / update / delete). Year rollover copies structure without students; use student promotion to move students.

Rules & edge cases

  • Gated behind the class_management plan key — tenants without it do not get the module.
  • Tenant-scoped: every query is isolated by tenant; a student can only be added to a class in the same tenant.
  • Capacity is enforced on student add.
  • Branch-restricted sub-admins only see/touch classes in their units; tenant-wide structural ops (/classes/copy, /subjects/by-grade) are denied (403) for them since they can’t be scoped per-row.
  • unassigned-students returns only classless students, so it is empty for branch-restricted users.

Where it lives

  • Backend: server/modules/classes/, server/modules/class_subjects/
  • Admin web: Classes page + admin-web/src/services/classesService.ts
  • Plan key: class_management