Naalya Handbook
School features

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 pathoperationIdPermissionNotes
POST /campuscreateCampusCreate on campusAudited
GET /campuslistCampusesList on campusOnly campuses the caller may read, ordered by name
GET /campus/:idgetCampusRead on campusCampus not found when missing
GET /campus/:id/academic-contextgetCampusAcademicContextRead on campusThe current campus year and current term
PATCH /campus/:idupdateCampusUpdate on campusAudited
PUT /campus/:id/admission-letterupdateCampusAdmissionLetterUpdate on applicationAudited as a campus update
DELETE /campus/:iddeleteCampusDelete on campusSoft 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:

ConditionMessage
The campus is the school's default campusThis is the default campus. Choose another default campus in school settings first.
The campus has WhatsApp or email accounts connectedRemove this campus's WhatsApp and email accounts first.
The campus has knowledge base documentsMove 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-API at fbb63d5178bcfe171292daebb19b6cbdac025a44: apps/server/src/app/campus/campus.controller.ts, campus.service.ts (create, findAll, findOne, update, updateAdmissionLetter, remove, getAcademicContext), dto/create-campus.dto.ts, and dto/campus-admission-letter.dto.ts, plus application/letters/admission-letter.service.ts (buildLetter) and admission-application.service.ts (admissionFeeLine).
  • Education-Hub at 9e84f4c33d5f1a9b9ae84bd7f1e6663598504073: src/routes/_authenticated/staff-hub/school/campuses/new.tsx and src/routes/_authenticated/staff-hub/campus.$campusId/settings/admission-letter/index.tsx.

On this page