Skip to main content

School Module

Location: backend/src/school/

The school module manages school records. Schools are the top-level organizational unit - every user belongs to a school, and all data (students, subjects, classes) is scoped to a school.

Files

FilePurpose
school.module.tsModule definition
school.controller.tsAPI endpoints
school.service.tsBusiness logic
dto/create-school.dto.tsValidation for school creation

Data Model

A school record contains:

FieldTypeDescription
idUUIDPrimary key
namestringSchool name
codestring?Optional school code
school_typeenumprimary or secondary
parishstringParish/district location
addressstring?Optional physical address
emailstringContact email
phonestringContact phone
is_activebooleanWhether the school is active

API Endpoints

All endpoints require AuthGuard.

GET /api/schools

Returns all active schools ordered by name. Used during onboarding to let users select their school.

Response: Array of school objects.


POST /api/schools

Creates a new school.

Body:

{
"name": "Grenada Academy",
"code": "GA",
"schoolType": "secondary",
"parish": "St. George",
"address": "123 Main St",
"email": "info@school.com",
"phone": "+1473-555-0100"
}
FieldRequiredNotes
nameYes
codeNo
schoolTypeYesMust be primary or secondary
parishYes
addressNo
emailYesMust be valid email
phoneYes

Response: The created school object.