This api was created for: create, read, update and delete student, teacher, group and lesson.
You must create user with role = 'admin'. Special api for this action I dont create.
So, If you want create admin, you should open MongoDB Atlas.
In order to "read" or "read/{id}" you must be authorization with any role.
If you want create, update or delete, you must be authorization with role = 'admin'.
At start send POST request in "/login" with body:
{ "email": "admin@admin.com", "password": "admin" }
The email and password must match the user that you created. \
API for group:
- Read all group: GET method in "/group";
- Read group by name: GET method in "/group/{name}" (you can get name from "Read all group");
- Create group: POST method in "/group" with body:
{"name": "TEST"}
; - Delete group: DELETE method in "/group" with body:
{"name": "TEST"}
; - Update student: PUT method in "/student" with body:
{"name": "TEST", "students" : ["test1@test.com", "test2@test.com"]}
. All field is required. "Name" its name of group that you want update. "Students" its arrays of student that will be in this group.
API for student:
- Read all student: GET method in "/student";
- Read student by id: GET method in "/student/{id}" (you can get id from "Read all student");
- Create student: POST method in "/student" with body:
{"name": "TEST", "email": "TEST@TEST.com", "password": "123456", "groupName": "TEST"}
; - Delete student: DELETE method in "/student" with body:
{"email": "TEST@TEST.com"}
; - Update student: PUT method in "/student" with body:
{"email": "s11@a.com", "newName": "v232", "newEmail": "s1@a.com", "password": "654321", "newPassword": "123456", "newGroup": "IP-81"}
. Only field "email" is required, other of your choice;
API for teacher:
- Read all teacher: GET method in "/teacher";
- Read teacher by id: GET method in "/teacher/{id}" (you can get id from "Read all teacher");
- Create teacher: POST method in "/teacher" with body:
{"name": "TEST", "email": "TEST@TEST.com", "password": "123456", "subject": "TEST", "age":27, experience: 2}
; - Delete teacher: DELETE method in "/teacher" with body:
{"email": "TEST@TEST.com"}
; - Update teacher: PUT method in "/teacher" with body:
{"email": "s11@a.com", "newName": "v232", "newEmail": "s1@a.com", "password": "654321", "newPassword": "123456", "newName": "TEST", "newSubject": "TEST", "newExperience": 3, "newAge": 28}
. Only field "email" is required, other of your choice;
API for lesson:
- Read all lesson: GET method in "/lesson";
- Read lesson by id: GET method in "/lesson/{id}" (you can get id from "Read all lesson");
- Create lesson: POST method in "/lesson" with body:
{"subject": "MATH", "teacher": "t1@a.com", "group": "IP-82", "classroom": "123-18", "startTime": "12:15", "endTime": "19:23"}
; Time must be in format "hh:mm"; - Delete lesson: DELETE method in "/lesson" with body:
{"id": "TEST"}
. You can get id from "Read all lesson". - Update lesson: PUT method in "/lesson" with body:
{"id": "5e32d77472a72d2d1c457616", "newSubject": "NEWWWW", "newTeacher": "NEWTEACHER@TEST.TEST", "newGroup": "NEWTEST", "newClassroom": "NEWCLASSROOM", "newStartTime": "NEW", "newEndTime": "NEW"}
. Only field "id" is required, other of your choice;