Naalya Handbook
School featuresGrading

Grading operations

Assessment, score, config, and template routes, including who is allowed to call each one.

Prefix every path with /api/v1. All four controllers require Feature.GRADING and user type staff. Assessment and score routes do not use @RequirePermissions. Their class comments say the service checks a teaching relationship (SubjectXTeacher) instead. Config and template routes do use grading_config permissions. None of these handlers were called. The compute rules are on Grading.

What a teacher does

  1. GET /grading/scores/matrix?subjectId&termId&streamId (getAssessmentScoreMatrix) loads the grid. All three query names are required. The text says one row per active enrollment and null where a score is missing.
  2. PUT /grading/scores (upsertAssessmentScores) writes the grid. Body is UpsertAssessmentScoresDto (subjectId, termId, streamId, rows). The text says each score must sit in [0, maxScore], each assessmentId must belong to that subject and term, and the enrollment is checked against the real stream rather than the request alone. The response decorator is 200 with no body type. The handler returns the service result, which the comment says is void.
  3. POST /grading/scores/recompute (recomputeGradebook, 201 { "message": "Gradebook recomputed" }) rebuilds grades for that subject, term, and stream after a config change. The text says it is idempotent and uses the same teaching check.

Linking a CBT exam is separate: POST /grading/assessments/:id/link-cbt-exam with body LinkCbtExamDto (examinationId is the field the handler reads). The text says the exam must share the assessment’s subject and term, must be assigned to a stream, and must not already be linked elsewhere. DELETE /grading/assessments/:id/link-cbt-exam removes the link and the text says existing scores stay editable.

Assessments

Controller AssessmentController, prefix grading/assessments. The class comment says this controller no longer creates assessments. Definitions come from the grading config, and the first list materialises rows.

Method and pathoperationIdAuth beyond staff + featureResult the decorator names
GET /listAssessmentsTeaching relationship, asserted in the service200 array of AssessmentDto. Query ListAssessmentsQueryDto
POST /:id/link-cbt-examlinkCbtExamToAssessmentSame200 AssessmentDto. 404 “Assessment or examination not found.”
DELETE /:id/link-cbt-examunlinkCbtExamFromAssessmentSame200. 404 “Assessment not found.”

Scores

Controller AssessmentScoreController, prefix grading/scores.

Method and pathoperationIdError copy on the decorator
GET /matrixgetAssessmentScoreMatrixAuth failures from the service were not copied
PUT /upsertAssessmentScores400 “Unknown assessmentId, score out of range, or enrollment not in stream.”
POST /recomputerecomputeGradebook400 “Invalid subject, term, or stream id.”

Configs

Controller GradingConfigController, prefix grading/configs.

Method and pathoperationIdPermissionResult
POST /createGradingConfigcreate grading_config201 GradingConfigDto. The text says bands must tile 0–100, group weights sum to 100, and one config exists per campus year and level
POST /defaultcreateDefaultGradingConfigcreate grading_config201. The text says this seeds a Ugandan O-level config and fails if one already exists
GET /listGradingConfigslist grading_config200. Optional query campusId. The handler also reads CurrentUser('campusId') and passes that value to list
GET /:idgetGradingConfigread grading_config200. 404 “Grading config not found.”
PATCH /:idupdateGradingConfigupdate grading_config200. The text says supplying bands replaces the set, and groups reconcile by id
POST /:id/recomputerecomputeGradingConfigupdate grading_config201 { "message": "Recompute complete" }
DELETE /:iddeleteGradingConfigdelete grading_config200 { "message": "Grading config deleted successfully" }

GET /grading/templates is GradingTemplatesController.list, operation id listGradingTemplates. It requires create on grading_config and returns the built-in templates. There is no write route on that controller.

Teaching checks

GradingAccessService resolves the JWT user id to a staff profile and throws Staff profile not found when there is none. The comment says a check that skipped this step would compare a user id with a staff-profile id and fail every time. There is no CASL fallback on these writes.

CallWho passesException
assertTeachesSubjectAny SubjectXTeacher row for the subjectYou do not teach this subject
assertCanViewStreamTeaches that subject in that stream, or is class teacher of the streamYou do not teach this subject in this stream
assertCanGradeStreamTeaches that subject in that stream. A class teacher does not passSame sentence
assertCanEnterScoreLoads the enrollment. Missing enrollment is Enrollment not found. No streamId is Enrollment has no stream assignment. Otherwise assertCanGradeStream using the enrollment’s stream, not a stream id from the requestAs above
assertIsClassTeacherOfStreamA ClassXTeacher row for that streamYou are not the class teacher of this stream

The class comments on the controllers say the service asserts these. This pass did not re-read each assessment and score method to name which of the five it calls. The exception strings are the ones those methods throw when they are called.

Sources

Naalya-API a5dff0c208d5193c274d3d1f87787b55344d5d30: assessment.controller.ts, assessment-score.controller.ts, grading-config.controller.ts, grading-templates.controller.ts, grading-access.service.ts. No handler was called.

On this page