Terms
Campus terms inside a campus academic year. The routes, who may read them, what a locked year refuses, report release, and what the Hub forms add.
A term belongs to one campus academic year. Grades, report cards, and timetables point at a term, so the term routes carry the same year lock as everything else. The staff steps are on Create an academic year. The year itself is on Locking and lifecycle.
What the Hub forms check
The school Create Academic Year panel only offers a Year from this calendar year to five years ahead, fills Name with the year plus Academic Year until it is edited, and refuses a Start Date before today or an End Date before the start. Those are panel rules. The API does not compare the dates, and the DTO has no maximum on name or year. The panel does not send order, so the service assigns the next one.
The Create Term panel offers term numbers 1 to 10, strikes through numbers already used on the year, and derives the name (First term to Tenth term). It checks that the end date is on or after the start with a string comparison on YYYY-MM-DD values. The API accepts any term number and a non-empty name, does not reserve numbers, and does not compare the dates. The create call does not send reportsReleaseAt.
Overview places term dates with dayOf in -year-planner.tsx, which keeps the first ten characters and parses them as a local calendar day. Coming up, Now, and Done compare those days with the start of today.
Setting the current term calls toggleField with isCurrent true and the campus year id as the filter. In one transaction it clears the flag on every other term in that year and sets it on the chosen one.
Routes and refusals
Generated from term/campus-term.controller.ts at API fbb63d51. Who is the permission each route checks.
| Route | Operation id | Does | Who |
|---|---|---|---|
POST /campus/:campusId/academic-year/:campusAcademicYearId/term | createCampusTerm | Create term | create on academic_year |
GET /campus/:campusId/academic-year/:campusAcademicYearId/term | listCampusTerms | List terms | list on campus_term |
GET /campus/:campusId/academic-year/:campusAcademicYearId/term/:id | getCampusTerm | Get term | read on campus_term |
PATCH /campus/:campusId/academic-year/:campusAcademicYearId/term/:id | updateCampusTerm | Update term | update on academic_year |
PATCH /campus/:campusId/academic-year/:campusAcademicYearId/term/:id/set-current | setCurrentCampusTerm | Set current term | update on academic_year |
POST /campus/:campusId/academic-year/:campusAcademicYearId/term/:id/release-reports | releaseTermReports | Release reports | update on academic_year |
DELETE /campus/:campusId/academic-year/:campusAcademicYearId/term/:id | deleteCampusTerm | Delete term | delete on academic_year |
Prefix the paths with /api/v1. The controller is campus/:campusId/academic-year/:campusAcademicYearId/term. campusId is on the path. Create, update, set-current, release, and delete do not pass it into the service. The year is loaded by its id through the tenant-scoped repository. A missing year is Campus academic year not found. A missing term is Campus term not found.
Create, update, set-current, release-reports, and delete require the academic year permission (create, update, or delete as named). List and get require campus term list or read. A locked year refuses create, update, set-current, release, and delete with Academic year is locked. Release goes through update, so the lock applies there too.
A guardian can list or read terms only with a verified link to a child enrolled in that campus year. A student must be enrolled in that year. Otherwise the sentence is You do not have access to terms for this academic year. A missing profile is Guardian profile not found or Student profile not found. Staff skip that enrolment check. The route permission still applies.
Update is a partial of the create fields: name, description, start, end, term number, and reportsReleaseAt. Changing the release instant restamps releasedAt on approved report cards for that term and clears reportsReleasedNotifiedAt. Release-reports sets the release instant to now and tries to queue ReleaseTermReports. A queue failure is logged and the updated term is still returned. The terms tab that was opened has no release button and no delete button.
Delete soft-deletes. If any timetable row still points at the term, the service refuses with This term has a timetable. Otherwise the answer is { "message": "Term deleted successfully" }. The service does not compare the two dates, and it does not reject a duplicate term number. The create form’s end check is a string comparison (end >= start) on the values the date picker writes. For a YYYY-MM-DD value that follows calendar order. The term entity stores startDate and endDate on columns with no explicit database type. reportsReleaseAt is the column that is declared timestamptz. Overview places those dates with dayOf. That helper keeps the first ten characters of the string and parses them as a local calendar day. A value that begins 2026-02-01 stays 1 February on the planner, including when the rest of the string is a UTC midnight. Coming up, Now, and Done compare those local days with the start of today. The create form’s own check is still the string comparison, and the service still stores the dates without comparing them.
Sources
Read at Hub d2d5fe3365d8fb858d18b9a29bc8a7e1b042f06d: the campus academic-year page, the overview and list tabs, -year-planner.tsx dayOf, the school academic-year page, create-academic-year.panel.tsx, -academic-year-terms.tab.tsx, and create-term.surface.tsx. Read at API a5dff0c208d5193c274d3d1f87787b55344d5d30: academic-year.service.ts create, campus-term.controller.ts, campus-term.service.ts, campus-term.entity.ts, base.repository.ts toggleField, and the create and update DTOs. No year or term was created. These files are unchanged at API fbb63d5178bcfe171292daebb19b6cbdac025a44 and Hub 9e84f4c33d5f1a9b9ae84bd7f1e6663598504073.
Locking and lifecycle
Creating, starting, and sealing academic years, the lock write-gate, transactional set-current, order-derived phase, and delete protection.
Scoped entities
The sixteen entities pinned to a campus academic year, the structural data that deliberately is not, and children that scope through their parent.