Campuses
Create, read, update, and delete a campus, the admission letter each campus prints, and what delete does and does not check.
A campus is one site of a school. Almost everything operational hangs off it: academic years are started per campus, classes and staff scope belong to a campus, and an admission is for a campus. The campus row itself is small: a name, a description, contact details, an address, a generated slug, and the admission letter settings.
This page is the HTTP reference for CampusController. The staff steps are on Manage campuses. How campus scope limits what staff see is on Scoping rules.
Routes
All routes are under /api/v1/campus and need a signed-in user. Each one requires the permission in the table, and the service then checks that permission against the campus row itself, so campus-scoped staff only reach their own campuses.
| Method and path | operationId | Permission | Notes |
|---|---|---|---|
POST /campus | createCampus | Create on campus | Audited |
GET /campus | listCampuses | List on campus | Only campuses the caller may read, ordered by name |
GET /campus/:id | getCampus | Read on campus | Campus not found when missing |
GET /campus/:id/academic-context | getCampusAcademicContext | Read on campus | The current campus year and current term |
PATCH /campus/:id | updateCampus | Update on campus | Audited |
PUT /campus/:id/admission-letter | updateCampusAdmissionLetter | Update on application | Audited as a campus update |
DELETE /campus/:id | deleteCampus | Delete on campus | Soft delete. Audited |
Create and update
Create takes name (required), description, email, phone, and address. The service generates a unique slug. If it cannot, the request fails with the generator's error as a 400. A missing description is stored as an empty string, because the column cannot be null.
Creating a campus also calls SchoolCalendarService.ensureDefaults for the school, so the school calendar has its default entries.
Update changes only the fields you send. An address in the body is merged into the existing address row, which keeps its id.
Academic context
GET /campus/:id/academic-context is what the staff hub uses to pick its default year and term. It is worked out on each request, not stored.
It looks for the campus binding marked current. If there is none, it falls back to the binding named by campus.currentAcademicYearId. With no binding at all, campusAcademicYear and term are null. Otherwise it returns the binding's dates, the year from the binding's stored snapshot, and the campus term marked current for that binding, or null.
How the current flags are set is on Locking and lifecycle.
The admission letter
When an application is approved, the letter lists the campus's fees and what the family should do next. PUT /campus/:id/admission-letter replaces both lists:
{
"fees": [{ "label": "Tuition (A-level)", "amount": 850000 }],
"nextSteps": ["Report to the admissions office with this letter"]
}amount is a whole number of Uganda shillings, 0 or more. Labels and steps must contain a non-space character, and the service trims them. Both lists print in the order sent.
This route checks update on application, not on campus, because the letter belongs to admissions. The service checks that permission for this campus.
In the Hub the screen is Admission letter under the campus Settings, at /staff-hub/campus/$campusId/settings/admission-letter. It needs the admissions feature and update on application. The fee list always starts with an Admission fee row marked From Bursary. That row is not saved in this list. On the approval letter, AdmissionLetterService puts the application's own admission fee charge first, using the charge's item name and amount from LedgerService.resourceChargeSummary, when the application has one. The campus list follows it. See Admission payments.
Delete
Delete is a soft delete. Before it runs, the service refuses in three cases, each with 409:
| Condition | Message |
|---|---|
| The campus is the school's default campus | This is the default campus. Choose another default campus in school settings first. |
| The campus has WhatsApp or email accounts connected | Remove this campus's WhatsApp and email accounts first. |
| The campus has knowledge base documents | Move or delete this campus's knowledge base documents first. |
Those are the only checks. Delete does not count students, staff, classes, academic years, or payments on the campus, and it does not remove them. Their rows stay and still point at the soft-deleted campus. Treat delete as a tool for a campus created by mistake.
Sources
Read in code, not run.
Naalya-APIatfbb63d5178bcfe171292daebb19b6cbdac025a44:apps/server/src/app/campus/campus.controller.ts,campus.service.ts(create,findAll,findOne,update,updateAdmissionLetter,remove,getAcademicContext),dto/create-campus.dto.ts, anddto/campus-admission-letter.dto.ts, plusapplication/letters/admission-letter.service.ts(buildLetter) andadmission-application.service.ts(admissionFeeLine).Education-Hubat9e84f4c33d5f1a9b9ae84bd7f1e6663598504073:src/routes/_authenticated/staff-hub/school/campuses/new.tsxandsrc/routes/_authenticated/staff-hub/campus.$campusId/settings/admission-letter/index.tsx.