Classes and streams
The class and stream routes, what the Hub panels add on top, what delete leaves behind, and how the next class is proposed.
A class is a year group on a campus (Senior 3); a stream is a section inside it (Senior 3 A). Both are structure, not tied to an academic year; enrolments tie a student to a class for a year. Staff steps are on Set up a class.
API rules
Class and stream routes both use the class permission (create, list, read, update, delete); there is no stream permission.
| Class | Stream | |
|---|---|---|
| Required | campusId, non-empty name, non-empty gradeLevel, level (o-level or a-level) | classId, non-empty name; optional description and integer capacity |
| Checks | electiveMin and electiveMax (optional, at least 0, null clears) only refused when min > max: electiveMin cannot be greater than electiveMax. Level isn't checked against them. No unique name check; no minimum on order | Capacity not compared with enrolled count |
| Update | Partial of create, so a caller can send a new campusId | Partial of create, so a new classId moves the stream (no separate assign route) |
| Delete | Soft-deletes the class only; stream rows are left. Class deleted successfully | Soft-delete. Stream deleted successfully |
| Missing | Class not found | Stream not found |
Lists add the count of active enrolments in the campus's current year.
What the Hub adds
| Screen | Behaviour |
|---|---|
| Classes page | Needs list on class. Cards show grade level, name, stream count and current-year active students. Search filters loaded cards only. Empty: No O-Level classes / No A-Level classes; no match: No classes found |
| Create Class | Wrapped in create on class. Resets Level to O Level when opened (even from the A-Level tab). Refuses a negative Progression Order and Minimum cannot exceed maximum. Switching to A Level clears the elective fields |
| Add Stream | Capacity must be a positive whole number if given, so 0 won't submit |
| Class Settings tab | Needs update. Fields: Name, Grade Level, Level, Progression Order, Min and Max electives (O Level only), Description; no campus field. Name is required, Grade level is required. Toasts Class updated successfully / Failed to update class |
| Danger zone | Needs delete. Type the class name to confirm. The dialog says streams are deleted too, but the API leaves them |
Next class and the enrol wizard
getNextClass uses the student's latest enrolment:
| Latest enrolment | Result |
|---|---|
| None | No next class, not graduating, no prior enrolment |
Class has no order | No next class, not graduating |
Same-campus class with order + 1 exists | That class |
| No such class | Graduating |
The student page's enrol wizard offers the current campus year and later unlocked years, prefers the year being viewed, marks the proposed class Proposed, defaults status to Active, and sends the date as ISO. Enroll is hidden while the student has any active or pending enrolment, though the API would accept one in another year. API rules are on Enrollment.
The Class setup summary and Set up classes helpers are on AI helpers on staff screens.