Skip to main content

Student Module

Location: backend/src/student/

The student module manages student records for a school. Students are the core entities who get enrolled in classes, assigned to subjects, and graded on assessments.

Files

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

Data Model

Students are stored in the student schema (not public).

FieldTypeDescription
idUUIDPrimary key
first_namestringStudent's first name
last_namestringStudent's last name
genderstringStudent's gender
date_of_birthdate?Optional date of birth
school_idUUIDThe school the student belongs to
is_activebooleanWhether the student is currently active
enrollement_datedate?Optional enrollment date

API Endpoints

All endpoints require AuthGuard. Students are automatically scoped to the user's school.

GET /api/students

Returns all students for the user's school.

Query Parameters:

ParamRequiredDescription
searchNoSearch by first or last name (case-insensitive partial match)

Response: Array of student objects.


GET /api/students/:id

Returns a single student by ID.


POST /api/students

Creates a new student. The school is determined from the authenticated user's profile.

Body:

{
"firstName": "Jane",
"lastName": "Doe",
"gender": "female",
"dateOfBirth": "2015-03-15",
"enrollementDate": "2025-09-01"
}
FieldRequiredNotes
firstNameYes
lastNameYes
genderYes
dateOfBirthNo
enrollementDateNo

Error Handling:

  • Duplicate name within the same school → 409 Conflict

PATCH /api/students/:id

Updates a student. All fields are optional, plus isActive can be toggled.

Body:

{
"firstName": "Jane",
"isActive": false
}