Node Version
v15.4.0
Tests are run using jest
and supertest
npm test
- validation tests
- Should accept full entries
- Should not accept missing entries
- Should not accept empty fields
- endpoint tests
- GET
/workload
should return 200 - POST
/register
should return 204 with full body information - POST
/register
should 400 if body is missing items - POST
/register
should return 400 if body has empty fields
- GET
- Install dependencies
npm install
- Start server
npm start
This will start a docker container, and migrate the database from /database/DDL.sql
All reqeusts should be made to this base URL:
http://localhost:3000/api
/healthcheck
/register
- teacher
- name
- students (array of)
- name
- subject
- name
- subjectCode
- class
- name
- classCode
If any of the items already exist as their unique identifier, but name fields are different, it will be updated to that provided in the request.
All fields must be provided.
{
"students": [
{
"name": "Student A",
"email": "[email protected]"
},
{
"name": "Student B",
"email": "[email protected]"
}],
"class": {
"classCode": "P1-1",
"name": "P1 AA"
},
"subject": {
"subjectCode": SCI,
"name": "Science"
},
"teacher": {
"name": Teacher 1,
"email": "[email protected]"
}
}
/reports/workload
- method: GET
- expected response: 200
{
"Teacher 1": [
{
"subjectCode": "ENG",
"subjectName": "English",
"numberOfClasses": 1,
},
{
"subjectCode": "MATH",
"subjectName": "Mathematics",
"numberOfClasses": 3,
},
],
"Teacher 2": [
{
"subjectCode": "ENG",
"subjectName": "English",
"numberOfClasses": 2,
},
],
}