Naalya Handbook
School features

Subjects

How a campus subject is created, aligned to the national curriculum, offered to streams, given teachers, and removed.

A subject belongs to one campus and one level, is owned by a department, and may point at a national (NCDC) curriculum subject. It reaches students by being offered on a stream, and teachers by being assigned per stream.

All routes need a bearer token and a permission on subject; none has a feature flag. Paths start with /api/v1; the full list is in the route reference. Combinations only point at existing subjects whose kind is principal or subsidiary (see Combinations).

The subject

RoutePermissionNotes
POST /subjects (createSubject)createNeeds campusId, name, level, departmentId. Optional code, isCompulsory (false), description, curriculumSubjectId, kind
GET /subjects (listSubjects)listFilters campusId, level
GET /subjects/:id (getSubject)read
PATCH /subjects/:id (updateSubject)updateSetting or clearing curriculumSubjectId sets alignmentStatus
PATCH /subjects/:id/alignment (alignSubject)updateThe only way to store supplementary
DELETE /subjects/:id (deleteSubject)deleteSoft-deletes the subject and its links

Alignment. With a curriculumSubjectId, alignmentStatus is aligned; without one, unaligned. alignSubject with supplementary or unaligned clears the link.

Kind. principal or subsidiary, meant for A-level only. The service doesn't enforce that; the combination validator does.

Delete soft-deletes the subject's student subject rows, stream offerings, teacher links and schemes of work, then the subject itself, because soft deletes don't cascade.

WhenMessage
Unknown national subjectCurriculum subject not found
Unknown departmentDepartment not found
Department scoped to another campusDepartment must be school-wide or scoped to the subject campus
Same name on the campus (create or rename)A subject named "{name}" already exists on this campus. ... (it suggests putting the level in the name, for example "Physics (A level)")
Changing level while offered anywhere{name} is offered on {n} stream(s); remove it from them before changing its level
Deleting a subject used by a combinationSubject is part of a combination; remove it from the combination first
Unknown idSubject not found

Offering it on streams

RoutePermissionDoes
POST /subjects/:subjectId/streams (assignSubjectToStream)manageOffers it on one stream (classId, streamId)
POST /subjects/:subjectId/classes (assignSubjectToClass)manageOffers it on every stream of a class, skipping ones that have it
DELETE /subjects/:subjectId/classes/:classId/streams/:streamId (unassignSubjectFromStream)manageRemoves one stream
DELETE /subjects/:subjectId/classes/:classId (unassignSubjectFromClass)manageRemoves every stream of the class
listSubjectClasses, listClassSubjects, listStreamSubjectslistRead the links

After an offering is added, if the subject is compulsory or aligned to the national list, the service runs syncCompulsoryForStream. That backfills any missing compulsory subjects (school-compulsory plus NCDC-derived) for every active or pending enrollment in the stream. It only adds rows.

Removing an offering is a hard delete. It also removes the subject from students in that stream and hard-deletes the matching teacher links. (Deleting the subject itself soft-deletes instead.)

WhenMessage
Class on another campus{class} is not on the same campus as {subject}
Class and subject levels differ{subject} is an A-level subject; {class} is O level (or the reverse)
Stream already has itSubject is already assigned to this stream
Class has no streamsNo streams found for this class
Every stream already has itSubject is already assigned to all streams in this class
Nothing to removeSubject assignment not found for this stream (or for this class)

The single-stream route doesn't check that the stream belongs to the class.

Subject teachers

A teacher is linked per subject, class and stream (subject_x_teacher). These rows give the teacher their subject-teacher scope in the permission system.

RoutePermissionDoes
POST /subjects/:subjectId/stream-teachers (assignSubjectTeacherToStream)manageOne stream
POST /subjects/:subjectId/class-teachers (assignSubjectTeacherToClass)manageEvery stream of the class that offers the subject, skipping existing
DELETE .../classes/:classId/streams/:streamId/teachers/:staffId (unassignSubjectTeacherFromStream)manageHard delete, one stream
DELETE .../classes/:classId/teachers/:staffId (unassignSubjectTeacherFromClass)manageHard delete, whole class
listSubjectTeachers, listClassSubjectTeachers, listStaffSubjectsByClasslistRead the links
WhenMessage
Subject not offered on that stream{subject} is not offered on this stream yet; assign the subject to the stream first
Not offered on any stream of the class{subject} is not offered on any stream of this class yet
Already linked on that streamThis teacher is already assigned to this subject for this stream
Already linked on every streamTeacher is already assigned to this subject in all streams
Nothing to removeSubject teacher assignment not found for this stream (or for this class)

The national list

GET /curriculum/subjects (listCurriculumSubjects) and GET /curriculum/subjects/:id (getCurriculumSubject) need only a bearer token. Every school reads the same rows, in name order. An optional group filter isn't validated, so an unknown group returns an empty list. A missing id throws Curriculum subject not found.

On this page