Naalya Handbook
School featuresAdmissions and recruitment

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.

ActionAllowed fromDoes
UpdatedraftEdits
SubmitdraftRuns 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
Paysubmitted, approved; owner onlyReturns an open payment if one exists, else starts one
Approvesubmitted; update on applicationSets approved, issues ADMISSION_APPROVAL_LETTER
AdmitapprovedSets admitted, issues ADMISSION_OFFER_LETTER. Blocked only when bursary is on for the campus and a charge exists unpaid. Creates no student
Rejectsubmitted, approvedCancels an unpaid charge, issues ADMISSION_REJECTION_LETTER
Enrol (StudentService.linkAdmissionApplication)admittedSets enrolled, issues ENROLMENT_LETTER with the student code, links a guardian owner (duplicate links ignored)
Unlink (unlinkAdmissionApplication)enrolledReturns to the status before enrolled (or admitted), removes the enrolment letter
WithdrawAnything but draftCancels an unpaid charge
DeleteNon-staff: draft only; staff: not enrolledRemoves the application
ActionRefused with
UpdateOnly pending applications can be updated
SubmitSelect a campus on the application before submitting
PayYou can only pay for your own application, No admission fee is due on this application, The admission fee is already paid
ApproveOnly submitted applications can be approved
AdmitOnly approved applications can be admitted, The admission fee has not been paid yet
RejectOnly submitted or approved applications can be rejected
EnrolOnly an admitted application can be linked, Admission application is already linked to another student
WithdrawDraft applications cannot be withdrawn, Application is already withdrawn
DeleteOnly 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 writtenFileNotification
approvedADMISSION_APPROVAL_LETTERADMISSION_APPROVED
admittedADMISSION_OFFER_LETTERADMISSION_OFFER
rejectedADMISSION_REJECTION_LETTERADMISSION_REJECTED
enrolledENROLMENT_LETTERADMISSION_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.

RouteOperation idDoesWho
POST /admission-applicationscreateAdmissionApplicationCreate applicationAny signed-in user
GET /admission-applicationslistAdmissionApplicationsList applicationslist on application
GET /admission-applications/campus/:campusIdlistAdmissionApplicationsByCampusIdList by campuslist on application
GET /admission-applications/minelistMyAdmissionApplicationsList my applicationsAny signed-in user
GET /admission-applications/:idgetAdmissionApplicationGet applicationread on application
GET /admission-applications/:id/previewpreviewAdmissionApplicationPreview applicationread on application
GET /admission-applications/:id/pdfdownloadAdmissionApplicationPdfDownload PDFread on application
PATCH /admission-applications/:idupdateAdmissionApplicationUpdate applicationupdate on application
PATCH /admission-applications/:id/placementupdateAdmissionPlacementUpdate placementstaff, update on application
PATCH /admission-applications/:id/submitsubmitAdmissionApplicationSubmit applicationupdate on application
POST /admission-applications/:id/initiate-paymentinitiateAdmissionPaymentInitiate paymentbursary feature
PATCH /admission-applications/:id/withdrawwithdrawAdmissionApplicationWithdraw applicationupdate on application
GET /admission-applications/:id/attachmentslistAdmissionApplicationAttachmentsList attachmentsread on application
POST /admission-applications/:id/attachmentsaddAdmissionApplicationAttachmentAdd attachmentupdate on application
POST /admission-applications/:id/signatureuploadAdmissionApplicationSignatureUpload signatureupdate on application
DELETE /admission-applications/:id/attachments/:storageIdremoveAdmissionApplicationAttachmentRemove attachmentupdate on application
PATCH /admission-applications/:id/approveapproveAdmissionApplicationApprove applicantstaff, update on application
PATCH /admission-applications/:id/admitadmitAdmissionApplicationAdmit applicantstaff, update on application
PATCH /admission-applications/:id/rejectrejectAdmissionApplicationReject applicantstaff, update on application
PATCH /admission-applications/:id/archivearchiveAdmissionApplicationArchive applicationstaff, delete on application
PATCH /admission-applications/:id/unarchiveunarchiveAdmissionApplicationUnarchive applicationstaff, delete on application
POST /admission-applications/:id/letters/:typereissueAdmissionLetterRe-issue letterstaff, update on application
DELETE /admission-applications/:id/letters/:typedeleteAdmissionLetterDelete letterstaff, delete on application
DELETE /admission-applications/:iddeleteAdmissionApplicationDelete applicationdelete 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.

Where to go next

On this page