Admissions
How an application moves from draft to admitted, when the fee is checked, and how the PDF URL is returned.
An admission application is the form a family fills in before a student profile exists. The row stores userId. Submit does not check the fee. Admit does. The steps below are the ones admission-application.service.ts writes.
The entity
The type has userId, optional campusId, status, reference, learner fields, academic history (uceResults, preferredCombinations, schoolsAttended), primary and secondary guardian fields, health, and a declaration with signatureId. Section comments in that file are A learner, B academic, C guardians, D health, E declaration.
The lifecycle, transition by transition
The status strings are draft, submitted, approved, admitted, rejected, enrolled, and withdrawn. There is no accepted or offered status. A missing application is Admission application not found.
| Action | Allowed from | Does |
|---|---|---|
| Update | draft | Edits |
| Submit | draft | Runs assertComplete, sets submitted, raises the admission-fee charge if the campus has a fee item and none exists, sends the received notice. Teams and WhatsApp alerts are best effort |
| Pay | submitted, approved; owner only | Returns an open payment if one exists, else starts one |
| Approve | submitted; update on application | Sets approved, issues ADMISSION_APPROVAL_LETTER |
| Admit | approved | Sets admitted, issues ADMISSION_OFFER_LETTER. Blocked only when bursary is on for the campus and a charge exists unpaid. Creates no student |
| Reject | submitted, approved | Cancels an unpaid charge, issues ADMISSION_REJECTION_LETTER |
Enrol (StudentService.linkAdmissionApplication) | admitted | Sets enrolled, issues ENROLMENT_LETTER with the student code, links a guardian owner (duplicate links ignored) |
Unlink (unlinkAdmissionApplication) | enrolled | Returns to the status before enrolled (or admitted), removes the enrolment letter |
| Withdraw | Anything but draft | Cancels an unpaid charge |
| Delete | Non-staff: draft only; staff: not enrolled | Removes the application |
| Action | Refused with |
|---|---|
| Update | Only pending applications can be updated |
| Submit | Select a campus on the application before submitting |
| Pay | You can only pay for your own application, No admission fee is due on this application, The admission fee is already paid |
| Approve | Only submitted applications can be approved |
| Admit | Only approved applications can be admitted, The admission fee has not been paid yet |
| Reject | Only submitted or approved applications can be rejected |
| Enrol | Only an admitted application can be linked, Admission application is already linked to another student |
| Withdraw | Draft applications cannot be withdrawn, Application is already withdrawn |
| Delete | Only draft applications can be deleted, Enrolled applications cannot be deleted |
assertComplete: the missingFields pattern's home
submit calls assertComplete before it changes status. listMissingFields requires firstName, lastName, gender, dateOfBirth, level, classOfAdmission, primaryGuardianName, primaryGuardianPhoneNumber, secondaryGuardianName, secondaryGuardianPhoneNumber, signedBy, signatureId, dateSigned, and categoryOfSignee. An A-level application also requires preferredCombinations. A field is missing when it is null, undefined, or an empty array. false counts as answered. The throw is Application is incomplete, with missingFields on the body. That is the object shape on the error envelope. There is no father or mother field in this list.
Letters
A letter failure never rolls back the status write. issue catches its own error, logs Admission letter issue failed, and returns. No schoolId skips the letter. Submit does not store a letter. notifyReceived emits ADMISSION_RECEIVED only.
| Status just written | File | Notification |
|---|---|---|
approved | ADMISSION_APPROVAL_LETTER | ADMISSION_APPROVED |
admitted | ADMISSION_OFFER_LETTER | ADMISSION_OFFER |
rejected | ADMISSION_REJECTION_LETTER | ADMISSION_REJECTED |
enrolled | ENROLMENT_LETTER | ADMISSION_ENROLLED |
The file name ADMISSION_OFFER_LETTER is the letter issued at admit. It is not a status called offered. The approval letter includes the charge line when one exists, plus the campus letter’s fees and next steps. A guardian’s link is /guardian/letters. Any other owner uses /guest/letters. The read model shows a stored file as ready. A type expectedLetterTypes still wants, and that has no file yet, is preparing. approved expects the approval letter. admitted and enrolled also expect it only when history contains a status row whose to is approved. rejected expects the rejection letter. draft, submitted, and withdrawn expect none.
POST .../letters/:type (reissueAdmissionLetter) is staff with update. The type must be one that status already carries (This application does not carry that letter). It renders again with notify: false. DELETE .../letters/:type is staff with delete. A missing file is Letter not found. An unknown type on either route is Unknown letter type.
PDFs render in the worker
renderApplicationPdf returns { url }. A stored ADMISSION_APPLICATION_PDF is reused when it is newer than the application, the school, the branding, and the campus. Otherwise the method enqueues one render job, with one attempt, and waits up to 35 seconds. A timeout whose message contains “timed out” is PDF render timed out (GatewayTimeoutException). Any other worker failure is PDF render failed. An application with no school throws This application has no school. The letter files are separate storage types, named above. The worker’s PDF library was not opened.
Routes
Every route on admission-application.controller.ts, generated from the code at API fbb63d51. The controller requires the admissions feature. Who lists the extra checks on each route; "Any signed-in user" means the route has no user-type or permission decorator, so the service decides. Prefix every path with /api/v1.
| Route | Operation id | Does | Who |
|---|---|---|---|
POST /admission-applications | createAdmissionApplication | Create application | Any signed-in user |
GET /admission-applications | listAdmissionApplications | List applications | list on application |
GET /admission-applications/campus/:campusId | listAdmissionApplicationsByCampusId | List by campus | list on application |
GET /admission-applications/mine | listMyAdmissionApplications | List my applications | Any signed-in user |
GET /admission-applications/:id | getAdmissionApplication | Get application | read on application |
GET /admission-applications/:id/preview | previewAdmissionApplication | Preview application | read on application |
GET /admission-applications/:id/pdf | downloadAdmissionApplicationPdf | Download PDF | read on application |
PATCH /admission-applications/:id | updateAdmissionApplication | Update application | update on application |
PATCH /admission-applications/:id/placement | updateAdmissionPlacement | Update placement | staff, update on application |
PATCH /admission-applications/:id/submit | submitAdmissionApplication | Submit application | update on application |
POST /admission-applications/:id/initiate-payment | initiateAdmissionPayment | Initiate payment | bursary feature |
PATCH /admission-applications/:id/withdraw | withdrawAdmissionApplication | Withdraw application | update on application |
GET /admission-applications/:id/attachments | listAdmissionApplicationAttachments | List attachments | read on application |
POST /admission-applications/:id/attachments | addAdmissionApplicationAttachment | Add attachment | update on application |
POST /admission-applications/:id/signature | uploadAdmissionApplicationSignature | Upload signature | update on application |
DELETE /admission-applications/:id/attachments/:storageId | removeAdmissionApplicationAttachment | Remove attachment | update on application |
PATCH /admission-applications/:id/approve | approveAdmissionApplication | Approve applicant | staff, update on application |
PATCH /admission-applications/:id/admit | admitAdmissionApplication | Admit applicant | staff, update on application |
PATCH /admission-applications/:id/reject | rejectAdmissionApplication | Reject applicant | staff, update on application |
PATCH /admission-applications/:id/archive | archiveAdmissionApplication | Archive application | staff, delete on application |
PATCH /admission-applications/:id/unarchive | unarchiveAdmissionApplication | Unarchive application | staff, delete on application |
POST /admission-applications/:id/letters/:type | reissueAdmissionLetter | Re-issue letter | staff, update on application |
DELETE /admission-applications/:id/letters/:type | deleteAdmissionLetter | Delete letter | staff, delete on application |
DELETE /admission-applications/:id | deleteAdmissionApplication | Delete application | delete on application |
Permissions and audit
The controller requires Feature.ADMISSIONS. Create and GET mine have no @RequirePermissions. Approve, admit, reject, placement, reissue, archive, unarchive, and delete-letter also require user type staff. Archive and unarchive ask the decorator for delete, then the service checks update. A caller who can delete but not update gets past the decorator and fails in the service. Submit does not compare user ids. Payment does, and it also requires Feature.BURSARY. Approve, admit, reject, withdraw, submit, archive, placement, letters, and delete write an audit row. Create and update do not. Initiate-payment does not.
The Hub hero shows Approve when the status is submitted, for a caller who can update application. Admit is a separate control. The API accepts it only from approved. A failed approve toasts Failed to approve application. A failed admit toasts Failed to admit application. The screen was read. It was not clicked.
Sources
Naalya-API a5dff0c208d5193c274d3d1f87787b55344d5d30: admission-application.controller.ts, admission-application.service.ts (submit, initiatePayment, approve, admit, reject, withdraw, remove, renderApplicationPdf, listMissingFields, reissueLetter), letters/admission-letter.service.ts (issue, notifyReceived), letters/expected-letters.ts, dto/admission-application.types.ts. student.service.ts (linkAdmissionApplication, unlinkAdmissionApplication). Education-Hub d2d5fe3365d8fb858d18b9a29bc8a7e1b042f06d: admissions_/-partials/-application-hero.tsx. No route was called.