Giter Club home page Giter Club logo

-div-elopers-1's Introduction

Advanced Computer Lab Project

  • Team Number : Team-9
  • Team Members : Sarah Ahmed - Amanallah Rafat - Mohamed Khaled - Salma Khaled - Ali Kabeel

Frontend Milestone :

  • Testing Milestone 2 Locally :

    • The Backend server runs on port 5000 using the command in the root directory : npm start
    • The Frontend server runs on port 3000 using the following commands in the root directory : cd client then npm start
    • Note : You should install the requied packages before trying to start the App using the following command in the both server and client sides :
      • For The server in The root directory : npm install
      • For the client side in the root directory : cd client then npm install
    • To start the data base by creating an HR you should call the route: /init (POST) This adds an HR manually to the database and should only be called once. To login the email is : [email protected] , the password is : 123456.

Testing The API Manually using Postman

  • The server can be run using : node server.js
  • The server runs on port 3000.
  • The server.js file in the root directory contains the connection string to the database.
  • You need to create an HR manually to start testing as this is the recommended starting point
  • The UML is provided in the file ACML Project.png in the root directory
  • To start the data base by creating an HR you should call the route: /init (POST) This adds an HR manually to the database and should only be called once. To login the email is : [email protected] , the password is : 123456

HR Functionalities

Functionality: Add a new location

Route: /hr/createLocation
Request Type: POST
Request Body: {"name" : "H12", "capacity" : 120, "type" : 0}
Note: Type denotes whether the location is a hall, tutorial room, lab or office. 0 -->hall, 1--> tut room, 2--> office, 3-->lab

Functionality: Update a location

Route: /hr/updateLocation/:ID
Request Type: PUT
Request Parameter: The ID of the location to be updated
Request body : {"name" : "H30","type" : 200}
Example of how to call the route: /hr/updateLocation/1
Response: {"error": "\"type\" must be less than or equal to 3"}
Request body : {"name" : "H30","type" : 2}
Response: Location Updated Successfully!
Request body : {"name" : ""}
Response: {"error": "\"name\" is not allowed to be empty}

Functionality: Delete a location

Route: /hr/deleteLocation/:ID
Request type: DELETE
Request parameters : The ID of the location to be deleted
Example of how to call the route: /hr/deleteLocation/1

Functionality: Add a staff member

Route: /hr/addStaffMember
Request Type: POST
Request Body : {"name": "user99", "email": "[email protected]", "type": 0, "dayOff": "sunday", "gender": "male", "officeID": 5, "salary": 8000,"departmentID": 1,"memberType":0}
Resposne: Registeration Completed!

Request Body : {"name": "user100", "email": "[email protected]", "type": 1, "dayOff": "saturday", "gender": "male", "officeID": 5, "salary": 8000}
Resposne: Registeration Completed!

Notes:
1- The officeID must be an ID of a location of type office (type = 2).
2- type denotes whether this staff member is an HR or an academic member (0-> academic member, 1-> hr)
3- memberType denotes whether this academic member is a HOD or an academic member (0 -> HOD, 3-> academic member)

Functionality: Update a staff member

Route: /hr/updateStaffMember/:ID/:type
Request Type: PUT
Request Body : {"memberType":0}
Resposne: Staff member Updated Successfully!

Request Body : {"ID": 2}
Resposne: { "error": "\"ID\" is not allowed" }

Request Body : {"departmentID": 4}
Resposne: Staff member Updated Successfully!

Request Body : {"officeID": 9}
Resposne: Staff member Updated Successfully!
Request Parameters : ID is the ID of the staff member, type denotes whether it's an HR or academic member (0--> academic member, 1 --> HR)
Example of how to call the route : /hr/updateStaffMember/1/0

Functionality: Delete a staff member

Route: /hr/deleteStaffMember/:ID/:type
Request Type: DELETE
Request Body :
Resposne: Staff member deleted successfully

Request Body :
Resposne: This user doesn't exist Request Parameters : ID is the ID of the staff member, type denotes whether it's an HR or academic member (0--> academic member, 1 --> HR)
Example of how to call the route : /hr/deleteStaffMember/1/0

Functionality: Add a new faculty

Route: /hr/createFaculty
Request Type: POST
Request Body: {"name" : "MET","departments" : [2,3]}
Note: Departments array contains the ids of departments.

Functionality: Update a faculty

Route: /hr/updateFaculty/:name
Request Type: PUT
Request Parameter: The name of the faculty to be updated
Request body : {"name" : "MET", "departments": [4]}
Example of how to call the route: /hr/updateFaculty/IET

Functionality: Delete a faculty

Route: /hr/deleteFaculty/:ID
Request type: DELETE
Request parameters : The name of the faculty to be deleted
Example of how to call the route: /hr/facultyLocation/MET

Functionality: Add a new department

Route: /hr/createDepartment
Request Type: POST
Request Body: {"name" : "CS","members" : [17], "hodID" : 17}
Request Body: {"name" : "DMET"}
Note: Members array contains the ids of members that should be added to the new department.

Functionality: Update a department

Route: /hr/updateDepartment/:ID
Request type: PUT
Request parameters : The ID of the department to be updated
Request body: {"hodID": 4}
Example of how to call the route: /hr/updateDepartment/2

Functionality: Delete a department

Route: /hr/deleteDepartment/:ID
Request type: DELETE
Request parameters : The ID of the department to be deleted
Example of how to call the route: /hr/deleteDepartment/1

Functionality: Create a new course

Route: /hr/createCourse
Request type : POST
Request body : {"name":"COMPUTER", "code": "CSEN111", "department": [4]}
Response : Course has been added successfully

Functionality: Update a course

Route: /hr/updateCourse/:ID
Request type : PUT
Request parameters : ID of the course that the HR wants to update
Request body : {"name":"COMPUTER PROGRAMMING"}
Response : Course has been updated successfully
Example of how to call the route : /hr/updateCourse/2

Functionality: Delete a course

Route: /hr/deleteCourse/:ID
Request type : DELETE
Request parameters : ID of the course that the HR wants to delete
Response : Course has been deleted successfully
Example of how to call the route : /hr/deleteCourse/2

Functionality: add missing sign in/ sign out session

add 'auth-token' of HR in the header

Route: /hr/addMissingSignInOut
Request type : POST
Request body : {"ID":1,"type":0, "signinYear":2020, "signinMonth":12, "signinDay":1, "signinHour":1, "signinMinute":0, "signinSec":0, "signoutYear":2021, "signoutMonth":12, "signoutDay":2, "signoutHour":1, "signoutMinute":0, "signoutSec":0}
Response : adding login/out has done successfully

Functionality: view a Staff member attendance

add 'auth-token' of HR in the header

Route: /hr/viewStaffMemberAttendance/:ID/:type
for example /hr/viewStaffMemberAttendance/1/1
Request type : GET
Request Parameters : ID is the ID of the staff member whose attendance is to be viewed. type is 0 if he is academic member and type is 1 if he is an HR
Response :
[ { "status": "attedant", "signin": "2020-12-17T12:49:25.810Z", "signout": "2020-12-17T12:49:32.526Z" } ]

Functionality: update staff Member salary

add 'auth-token' of HR in the header

Route: /hr/updateStaffMemberSalary
Request type : POST
Request body : {"ID":1,"type":1,"salary":4000}
Response : staff member salary has been updated successfully
Note: 1-ID is the ID of the staff member that the HR wants to update the salary for.
2- type denotes whether this staff member is an HR (type : 1) or academic member (type :0).

Functionality: view Staff members with missing hours

add 'auth-token' of HR in the header

Route: /hr/viewStaffMembersWithMissingHours
Request type : GET
Response :
[ { "attendanceRecord": [ { "status": 1, "signin": 1608209365810, "signout": 1608209372526 } ], "extraInfo": [], "name": "sarah", "ID": 1, "email": "[email protected]", "type": 1, "dayOff": "saturday", "gender": "female", "salary": 4000, "annualBalance": 2.5, "accidentalLeaveBalance": 6 }, { "attendanceRecord": [], "extraInfo": [], "name": "aca1", "ID": 1, "email": "[email protected]", "type": 0, "dayOff": "sunday", "gender": "male", "salary": 8000, "annualBalance": 2.5, "accidentalLeaveBalance": 6, "officeID": 5 }, { "attendanceRecord": [], "extraInfo": [], "name": "aaaaaa", "ID": 2, "email": "[email protected]", "type": 0, "dayOff": "sunday", "gender": "male", "salary": 8000, "annualBalance": 2.5, "accidentalLeaveBalance": 6, "officeID": null }, { "attendanceRecord": [], "extraInfo": [], "name": "User3", "ID": 3, "email": "[email protected]", "type": 0, "dayOff": "saturday", "gender": "male", "salary": 8000, "annualBalance": 2.5, "accidentalLeaveBalance": 6 }]
note that the output depends on the data inside the database and the current day when the code runs

Functionality: view Staff members with missing days

add 'auth-token' of HR in the header

Route: /hr/viewStaffMembersWithMissingDays
Request type : GET
Response :
[ { "attendanceRecord": [ { "status": 1, "signin": "2020-12-17T12:49:25.810Z", "signout": "2020-12-17T12:49:32.526Z" } ], "extraInfo": [], "name": "sarah", "ID": 1, "email": "[email protected]", "type": 1, "dayOff": "saturday", "gender": "female", "salary": 6000, "annualBalance": 2.5, "accidentalLeaveBalance": 6, "officeID": null }, { "attendanceRecord": [], "extraInfo": [], "name": "aaaaaa", "ID": 2, "email": "[email protected]", "type": 0, "dayOff": "sunday", "gender": "male", "salary": 8000, "annualBalance": 2.5, "accidentalLeaveBalance": 6, "officeID": null }, { "attendanceRecord": [], "extraInfo": [], "name": "User3", "ID": 3, "email": "[email protected]", "type": 0, "dayOff": "saturday", "gender": "male", "salary": 8000, "annualBalance": 2.5, "accidentalLeaveBalance": 6 }, { "attendanceRecord": [], "extraInfo": [], "name": "aca4", "ID": 4, "email": "[email protected]", "type": 0, "dayOff": "saturday", "gender": "female", "salary": 8000, "annualBalance": 2.5, "accidentalLeaveBalance": 6 }, { "attendanceRecord": [], "extraInfo": [], "name": "aca5", "ID": 5, "email": "[email protected]", "type": 0, "dayOff": "sunday", "gender": "female", "salary": 8000, "annualBalance": 2.5, "accidentalLeaveBalance": 6 }, { "attendanceRecord": [], "extraInfo": [], "name": "aca6", "ID": 6, "email": "[email protected]", "type": 0, "dayOff": "sunday", "gender": "male", "salary": 8000, "annualBalance": 2.5, "accidentalLeaveBalance": 6 }, { "attendanceRecord": [], "extraInfo": [], "name": "aca7", "ID": 7, "email": "[email protected]", "type": 0, "dayOff": "sunday", "gender": "male", "salary": 8000, "annualBalance": 2.5, "accidentalLeaveBalance": 6 }, { "attendanceRecord": [], "extraInfo": [], "name": "user99", "ID": 8, "email": "[email protected]", "type": 0, "dayOff": "sunday", "gender": "male", "officeID": 5, "salary": 8000, "annualBalance": 2.5, "accidentalLeaveBalance": 6 }, { "attendanceRecord": [], "extraInfo": [], "name": "user100", "ID": 2, "email": "[email protected]", "type": 1, "dayOff": "saturday", "gender": "male", "officeID": 5, "salary": 8000, "annualBalance": 2.5, "accidentalLeaveBalance": 6 } ]
note that the output depends on the data inside the database and the current day when the code runs
since it starts from the beginning of the academic month till the current day

Staff Member Functionality

Functionality: Login with a unique email and password.

Route: /login
Request type: POST
Request Body : {"email": "[email protected]","password":"team9111"}

Functionality: Logout an already loged in user

Route: /logout
Request type: POST

Functionality: sign in

add the 'auth-token' of a staff member

Route: /signIn
Request type: POST

Functionality: sign out

add the 'auth-token' of a staff member

Route: /signOut
Request type: POST

Functionality: View Profile

Route: /viewProfile
Request Type: GET
Response: {"extraInfo": [],"name": "mohamed","ID": 14,"email": "[email protected]","type": 0,"dayOff": "sunday", "gender": "male","officeID": 9,"salary": 5001,"annualBalance": 2.5,"accidentalLeaveBalance": 6}

Functionality: Reset Password

Route: /resetPassword
Request type: POST
Request Body : {"oldPassword":"123456","newPassword":"123457"}

Functionality: View Attendance

Route: /viewAttendance
Request Type: GET
Request Body: The Route has two options for the request body to view The whole Attendance Record or by month and the input requested body for the second should be like the following {"month":12}

Functionality: update staff Member profile

add 'auth-token' of the staff member in the header

Route: /updateMyProfile
Request type : POST
Request body : {"email":"[email protected]"}
Response : profile Updated Successfully!

Functionality: View Missing Days

add 'auth-token' of the staff member in the header

Route: /viewMissingDays
Request Type: GET
Response: [ "2020-12-13T00:00:00.000Z", "2020-12-14T00:00:00.000Z", "2020-12-15T00:00:00.000Z", "2020-12-16T00:00:00.000Z" ]

note that the output depends on the data inside the database and the current day when the code runs
since it starts from the beginning of the academic month till the current day

HOD functionality

Functionality: Assign course instructor

Route: /hod/assignCourseInstructor
Request Type: PUT
Request Body: {"courseID":3, "instructorID": 1}
Response: Course instructor assigned successfully

Functionality: Delete course instructor

Route: /hod/deleteCourseInstructor/:courseID
Request Type: DELETE
Request Parameters: The ID of the course
Request Body: {"instructorID":1}
Example of how to call the route: /hod/deleteCourseInstructor/1
Response: Course instructor was deleted successfully
Note: instructorID is the ID of the instructor that the hod wants to delete from the course

Functionality: Update course instructor

Route: /hod/updateCourseInstructor/:ID
Request Type: PUT
Request Parameters: The ID of the instructor that the HOD wants to update
Request Body: {"oldCourseID": 1, "newCourseID": 2}
Response: Update was successfull
Example of how to call the route: /hod/updateCourseInstructor/2
Note: newCourseID is the ID of the course that you want to assign the instructor to, oldCourseID is the ID of the course you want to remove the instructor from.

Functionality: View Staff member in department

Route: /hod/viewDepartmentMembers
Request Type: GET
Response : Array of staff members [ { "name": "aca6", "email": "[email protected]", "ID": 6, "type": 0, "dayOff": "sunday", "gender": "male", "officeID": "Not yet assigned", "departmentID": "MNGT", "extra info": [] }, { "name": "aca7", "email": "[email protected]", "ID": 7, "type": 0, "dayOff": "sunday", "gender": "male", "officeID": "Not yet assigned", "departmentID": "MNGT", "extra info": [] } ]

Functionality: View staff members by course

Route: /hod/viewDepartmentMembersByCourse/:courseID
Request Type: GET
Request Parameters: ID of the course whose teaching staff the head of the department wants to view

Response: Array of staff members [ { "name": "sarah", "email": "[email protected]", "ID": 1, "type": 1, "dayOff": "saturday", "gender": "female", "officeID": "Not yet assigned", "departmentID": "MET", "extra info": [] }, { "name": "aca2", "email": "[email protected]", "ID": 2, "type": 0, "dayOff": "sunday", "gender": "male", "officeID": "Not yet assigned", "departmentID": "MET", "extra info": [] } ]
Example of how to call the route: /hod/viewDepartmentMembersByCourse/1

Functionality: View all staff day off

Route: /hod/viewAllStaffDayOff
Request Type: GET

Response: Array containing staff member name, ID and day off [ { "name": "aca6", "id": "ac_6", "dayOff": "sunday" }, { "name": "aca7", "id": "ac_7", "dayOff": "sunday" } ]

Functionality: View day off of single staff member in department

Route: /hod/viewSingleStaffDayOff/:ID
Request Type: GET
Request Parameters: ID of the staff member the head of the department wants to view
Response: staff member name, ID and day off { "name": "aca6", "id": "ac_6", "day off": "sunday" }
Example of how to call the route: /hod/viewSingleStaffDayOff/1

Functionality: View course teaching assignments

Route: /hod/viewCourseTeachingAssignments/:ID
Request Type: GET
Request Parameters: ID of the course that the head of the department wants to view
Response: name of the course, code of the course and an array containing the slots of the course { "course name": "Graphics", "course code": "DMET501", "course slots": [ { "slot": { "ID": 1, "slotNumber": 1, "day": "monday", "locationID": 1 }, "staff member name": "Not yet assigned" }, { "slot": { "ID": 2, "slotNumber": 2, "day": "monday", "locationID": 1 }, "staff member name": "Not yet assigned" }, { "slot": { "ID": 3, "slotNumber": 3, "day": "monday", "locationID": 1 }, "staff member name": "Not yet assigned" } ] }
Example of how to call the route: /hod/viewCourseTeachingAssignments/1

Functionality: View course coverage

Route: /hod/viewCourseCoverage/:ID
Request Type: GET
Request parameters: The ID of the course.
Response: The coverage of the course which has the ID specified in the request parameters(in decimal)
Example of how to call the route: /hod/viewCourseCoverage/1

Functionality: View all requests

Route: /hod/viewAllRequests
Request Type: GET
Response: Array of all the requests that are sent to this head of department.
[ { "type": "accidental leave requests", "requests": [ { "_id": "5fdefc5983dc451970a8cdf3", "ID": 6, "senderID": 8, "receiverID": 8, "msg": "ali", "submissionDate": "2020-12-20T07:25:13.024Z", "requestedDate": "1970-01-01T00:00:00.123Z", "status": "pending", "__v": 0 } ] }, { "type": "annual leave requests", "requests": [] }, { "type": "change day off requests", "requests": [ { "_id": "5fde58e1c78ef437c4425b93", "ID": 3, "senderID": 1, "receiverID": 8, "msg": "", "targetDayOff": "monday", "submissionDate": "2020-12-19T19:47:45.077Z", "status": "pending", "__v": 0 }, { "_id": "5fde58e4c78ef437c4425b94", "ID": 4, "senderID": 1, "receiverID": 8, "msg": "", "targetDayOff": "monday", "submissionDate": "2020-12-19T19:47:48.452Z", "status": "pending", "__v": 0 } ] }, { "type": "compensation leave requests", "requests": [ { "_id": "5fde6190ecabe139c4220514", "ID": 1, "senderID": 1, "receiverID": 8, "submissionDate": "2020-12-19T20:24:48.822Z", "requestedDate": "2020-12-13T20:14:22.436Z", "absenceDate": "2020-12-12T20:14:51.516Z", "status": "pending", "__v": 0 }, { "_id": "5fde61b6ecabe139c4220515", "ID": 2, "senderID": 1, "receiverID": 8, "submissionDate": "2020-12-19T20:25:26.410Z", "requestedDate": "2020-12-06T20:25:18.099Z", "absenceDate": "2020-12-12T20:14:51.516Z", "status": "pending", "__v": 0 }, { "_id": "5fde61caecabe139c4220516", "ID": 3, "senderID": 1, "receiverID": 8, "submissionDate": "2020-12-19T20:25:46.172Z", "requestedDate": "2020-12-06T20:25:18.099Z", "absenceDate": "2020-12-06T20:25:18.099Z", "status": "pending", "__v": 0 }, { "_id": "5fde61dfecabe139c4220517", "ID": 4, "senderID": 1, "receiverID": 8, "submissionDate": "2020-12-19T20:26:07.983Z", "requestedDate": "2020-12-06T20:25:18.099Z", "absenceDate": "2020-12-12T20:14:51.516Z", "status": "pending", "__v": 0 }, { "_id": "5fde6229ecabe139c4220518", "ID": 5, "senderID": 1, "receiverID": 8, "submissionDate": "2020-12-19T20:27:21.913Z", "requestedDate": "2020-12-13T20:14:22.436Z", "absenceDate": "2020-12-12T20:14:51.516Z", "status": "pending", "__v": 0 }, { "_id": "5fde6276ecabe139c4220519", "ID": 6, "senderID": 1, "receiverID": 8, "submissionDate": "2020-12-19T20:28:38.203Z", "requestedDate": "2020-12-13T20:14:22.436Z", "absenceDate": "2020-12-23T20:28:29.192Z", "status": "pending", "__v": 0 }, { "_id": "5fde6b3cecabe139c422051c", "ID": 7, "senderID": 1, "receiverID": 8, "submissionDate": "2020-12-19T21:06:04.348Z", "requestedDate": "2020-12-06T20:25:18.099Z", "absenceDate": "2020-12-12T20:14:51.516Z", "status": "pending", "__v": 0 } ] }, { "type": "maternity leave requests", "requests": [ { "_id": "5fde5876c78ef437c4425b8a", "ID": 1, "senderID": 1, "receiverID": 8, "documents": "googl/ali", "submissionDate": "2020-12-19T19:45:58.760Z", "startDate": "2020-12-24T13:51:02.056Z", "endDate": "2020-12-29T13:56:19.792Z", "msg": "", "status": "pending", "__v": 0 }, { "_id": "5fde5879c78ef437c4425b8b", "ID": 2, "senderID": 1, "receiverID": 8, "documents": "googl/ali", "submissionDate": "2020-12-19T19:46:01.066Z", "startDate": "2020-12-24T13:51:02.056Z", "endDate": "2020-12-29T13:56:19.792Z", "msg": "", "status": "pending", "__v": 0 }, { "_id": "5fde587cc78ef437c4425b8c", "ID": 3, "senderID": 1, "receiverID": 8, "documents": "googl/ali", "submissionDate": "2020-12-19T19:46:04.334Z", "startDate": "2020-12-24T13:51:02.056Z", "endDate": "2020-12-29T13:56:19.792Z", "msg": "", "status": "pending", "__v": 0 }, { "_id": "5fde587fc78ef437c4425b8d", "ID": 4, "senderID": 1, "receiverID": 8, "documents": "googl/ali", "submissionDate": "2020-12-19T19:46:07.478Z", "startDate": "2020-12-24T13:51:02.056Z", "endDate": "2020-12-29T13:56:19.792Z", "msg": "", "status": "pending", "__v": 0 }, { "_id": "5fde58a7c78ef437c4425b8e", "ID": 5, "senderID": 1, "receiverID": 8, "documents": "googl/ali", "submissionDate": "2020-12-19T19:46:47.988Z", "startDate": "2020-12-24T13:51:02.056Z", "endDate": "2020-12-29T13:56:19.792Z", "msg": "", "status": "pending", "__v": 0 } ] }, { "type": "sick leave requests", "requests": [ { "_id": "5fde42634cc4174148983990", "ID": 1, "senderID": 4, "receiverID": 8, "documents": "jbdskjvbjas", "submissionDate": "2020-12-19T18:11:47.106Z", "requestedDate": "2020-12-18T18:11:23.669Z", "status": "pending", "msg": "We won!", "__v": 0 }, { "_id": "5fde42b34cc4174148983991", "ID": 2, "senderID": 4, "receiverID": 8, "documents": "jbdskjvbjas", "submissionDate": "2020-12-19T18:13:07.038Z", "requestedDate": "2020-12-18T18:11:23.669Z", "status": "pending", "msg": "We won!", "__v": 0 }, { "_id": "5fde42b54cc4174148983992", "ID": 3, "senderID": 4, "receiverID": 8, "documents": "jbdskjvbjas", "submissionDate": "2020-12-19T18:13:09.625Z", "requestedDate": "2020-12-18T18:11:23.669Z", "status": "pending", "msg": "We won!", "__v": 0 }, { "_id": "5fde42bd4cc4174148983993", "ID": 4, "senderID": 4, "receiverID": 8, "documents": "jbdskjvbjas", "submissionDate": "2020-12-19T18:13:17.976Z", "requestedDate": "2020-12-18T18:11:23.669Z", "status": "pending", "msg": "", "__v": 0 }, { "_id": "5fde4a1c4cc4174148983994", "ID": 5, "senderID": 4, "receiverID": 8, "documents": "jbdskjvbjas", "submissionDate": "2020-12-19T18:44:44.638Z", "requestedDate": "2020-12-18T18:11:23.669Z", "status": "pending", "msg": "", "__v": 0 }, { "_id": "5fde4a204cc4174148983995", "ID": 6, "senderID": 1, "receiverID": 8, "documents": "jbdskjvbjas", "submissionDate": "2020-12-12T18:44:48.828Z", "requestedDate": "2020-12-12T18:11:23.669Z", "status": "accepted", "msg": "", "__v": 0 } ] } ]

Functionality: Respond to change day off request

Route: /hod/respondToChangeDayOffRequest/:ID
Request Type: PUT
Request body : {"response": 1}
Response: Request accepted succefully
Request body : {"response":0, "msg":"You can't change it"}
Response: Request rejected succefully
Request Parameters : The ID of the change day off request that the HOD wants to respond to.
Example of how to call the route: /hod/respondToChangeDayOffRequest/3
Note: 1- To accept the request response is 1, to reject the request response is 0.
2- "msg" is optional if the HOD wants to state the reason for rejecting the request.

Functionality: Respond to annual leave request

Route: /hod/respondToAnnualLeaveRequests/:ID
Request Type: PUT
Request body : {"response": 1}
Response: Request was accepted successfully
Request body : {"response": 0,"msg": "I don't want to"}
Response: Request was rejected successfully
Request Parameters : The ID of the annual leave request that the HOD wants to respond to.
Example of how to call the route: /hod/respondToAnnualLeaveRequests/1
Note: 1- To accept the request response is 1, to reject the request response is 0.
2- "msg" is optional if the HOD wants to state the reason for rejecting the request.

Functionality: Respond to accidental leave request

Route: /hod/respondToAccidentalLeaveRequest/:ID
Request Type: PUT
Request body : {"response": 1}
Response: Request was accepted successfully
Request body : {"response": 0,"msg": "I don't want to"}
Response: Request was rejected successfully
Request Parameters : The ID of the accidental leave request that the HOD wants to respond to.
Example of how to call the route: /hod/respondToAccidentalLeaveRequest/3
Note: 1- To accept the request response is 1, to reject the request response is 0.
2- "msg" is optional if the HOD wants to state the reason for rejecting the request.

Functionality: Respond to sick leave request

Route: /hod/respondToSickLeaveRequests/:ID
Request Type: PUT
Request body : {"response": 1}
Response: Request was accepted successfully
Request body : {"response": 0,"msg": "I don't want to"}
Response: Request was rejected successfully
Request Parameters : The ID of the sick leave request that the HOD wants to respond to.
Example of how to call the route: /hod/respondToSickLeaveRequests/9
Note: - To accept the request response is 1, to reject the request response is 0.
2- "msg" is optional if the HOD wants to state the reason for rejecting the request.

Functionality: Respond to maternity leave request

Route: /hod/respondToMaternityLeaveRequest/:ID
Request Type: PUT
Request body : {"response": 1}
Response: Request was accepted successfully
Request body : {"response": 0,"msg": "I don't want to"}
Response: Request was rejected successfully
Request Parameters : The ID of the maternity leave request that the HOD wants to respond to.
Example of how to call the route: /hod/respondToMaternityLeaveRequest/1
Note: 1-To accept the request response is 1, to reject the request response is 0.
2- "msg" is optional if the HOD wants to state the reason for rejecting the request.

Functionality: Respond to compensation leave request

Route: /hod/respondToCompensationLeaveRequest/:ID
Request Type: PUT
Request body : {"response": 1}
Response: Request was accepted successfully
Request body : {"response": 0,"msg": "I don't want to"}
Response: Request was rejected successfully
Request Parameters : The ID of the compensation leave request that the HOD wants to respond to.
Example of how to call the route: /hod/respondToCompensationLeaveRequest/1
Note: 1-To accept the request response is 1, to reject the request response is 0.
2- "msg" is optional if the HOD wants to state the reason for rejecting the request.

Course Instructor Functionality

Functionality: View course coverage

Route Example: /ci/viewCourseCoverage/:courseID
Request Type: GET
Request parameters: The ID of the course.
Route Example: /ci/viewCourseCoverage/2
Response: The coverage of the course which has the ID specified in the request parameters(in decimal)

Functionality: View slot Assignemnts

Route: /ci/viewSlotAssignment
Request Type: GET
Response: Array of the course slots that the course instructor is assigned to. Response Example: [{"slots":[{"ID":1,"slotNumber":3,"day":"monday","locationID":1},{"ID":2,"slotNumber":2,"day":"monday","locationID":1},{"ID":3,"slotNumber":5,"day":"monday","locationID":1},{"ID":4,"slotNumber":5,"day":"monday","locationID":1},{"ID":5,"slotNumber":2,"day":"monday","locationID":1},{"ID":6,"slotNumber":2,"day":"tuesday","locationID":1},{"ID":7,"slotNumber":2,"day":"tuesday","locationID":34},{"ID":8,"slotNumber":2,"day":"tuesday","locationID":6},{"ID":9,"slotNumber":2,"day":"friday","locationID":6}],"id":"5fdf6dda7f75c63a8cf2928e","ID":1,"_v":0}]

Functionality: Get profiles of staff members in his/her department

Route: /ci/viewStaffProfilesInDepartment
Request Type: GET
Response: [{"name":"ac13","email":"[email protected]","ID":"ac-11","type":0,"dayOff":"sunday","gender":"male","officeID":2,"departmentID":2,"extra info":[]},{"name":"ac14","email":"[email protected]","ID":"ac-12","type":3,"dayOff":"sunday","gender":"male","officeID":2,"departmentID":2,"extra info":[]},{"name":"ac15","email":"[email protected]","ID":"ac-13","type":3,"dayOff":"sunday","gender":"male","officeID":3,"departmentID":2,"extra info":[]},{"name":"ac16","email":"[email protected]","ID":"ac-14","type":3,"dayOff":"sunday","gender":"male","officeID":3,"departmentID":2,"extra info":[]},{"name":"ac17","email":"[email protected]","ID":"ac-15","type":3,"dayOff":"sunday","gender":"male","officeID":3,"departmentID":2,"extra info":[]},{"name":"ac18","email":"[email protected]","ID":"ac-16","type":3,"dayOff":"sunday","gender":"male","officeID":3,"departmentID":2,"extra info":[]},{"name":"ac19","email":"[email protected]","ID":"ac-17","type":3,"dayOff":"sunday","gender":"male","officeID":3,"departmentID":2,"extra info":[]},{"name":"ac20","email":"[email protected]","ID":"ac-18","type":1,"dayOff":"sunday","gender":"male","officeID":3,"departmentID":2,"extra info":[]},{"name":"ac21","email":"[email protected]","ID":"ac-19","type":1,"dayOff":"sunday","gender":"male","officeID":3,"departmentID":2,"extra info":[]},{"name":"ac22","email":"[email protected]","ID":"ac-20","type":1,"dayOff":"sunday","gender":"male","officeID":3,"departmentID":2,"extra info":[]},{"name":"ac23","email":"[email protected]","ID":"ac-21","type":3,"dayOff":"sunday","gender":"male","officeID":3,"departmentID":2,"extra info":[]},{"name":"ac24","email":"[email protected]","ID":"ac-22","type":3,"dayOff":"sunday","gender":"male","officeID":3,"departmentID":2,"extra info":[]},{"name":"ac25","email":"[email protected]","ID":"ac-23","type":2,"dayOff":"sunday","gender":"male","officeID":3,"departmentID":2,"extra info":[]}]

Functionality: Get profiles of staff members in a course under his/her department

Route: /ci/viewStaffProfilesInCourse/:courseID
Requet Parameters: courseID represents an ID of existing course
Request Type: GET
Route Example: /ci/viewStaffProfilesInCourse/1
Response Example: [{"name":"ac25","email":"[email protected]","ID":"ac-23","type":2,"dayOff":"sunday","gender":"male","officeID":3,"departmentID":2,"extra info":[]},{"name":"ac22","email":"[email protected]","ID":"ac-20","type":1,"dayOff":"sunday","gender":"male","officeID":3,"departmentID":2,"extra info":[]},{"name":"ac21","email":"[email protected]","ID":"ac-19","type":1,"dayOff":"sunday","gender":"male","officeID":3,"departmentID":2,"extra info":[]},{"name":"ac20","email":"[email protected]","ID":"ac-18","type":1,"dayOff":"sunday","gender":"male","officeID":3,"departmentID":2,"extra info":[]}]

Functionality: Assign academic member to a slot

Route: /ci/assignAcademicMemberToSlot
Request Type: POST
Request Body: { "slotID": 1, "courseID": 2, "academicMemberID": 3 }
Response: Academic memeber is assigned to the slot the successfuly or Error if invalid body

Functionality: Remove academic member assignment from a slot

Route: /ci/removeAcademicMemberToSlot
Request Type: DELETE
Request Body: { "slotID": 1, "courseID": 2, "academicMemberID": 3 }
Response: Academic memeber assignment to the slot is removed successfuly or Error if invalid body

Functionality: Update academic member slot assignment

Route: /ci/updateAcademicMemberslotAssignment
Request Type: PUT
Request Body: { "oldSlotID": 2, "newSlotID": 1, "courseID": 2, "academicMemberID": 3 }
Response: Academic memeber assignment to the slot is updated successfuly

Functionality: Remove academic member from a course

Route: /ci/removeAcademicMemberFromCourse
Request Type: DELETE
Request Body: {"courseID": 1, "academicMemberID": 3 }
Response: Academic memeber removed successfully

Functionality: Assign academic as a coordinator

Route: /ci/assignCourseCoordinator
Request Type: PUT
Request Body: { "courseID": 2, "academicMemberID": 3 }
Response: Course coordinator is assigned successfully

Course Coordinator functionality

Functionality: View Slot Linking Requests

Route: /cc/viewSlotLinkingRequests
Request Type: GET
Response: [ { "_id": "5fdcbc693f1a9333a81f075e", "ID": 1, "senderID": 4, "receiverID": 3, "courseID": 2, "slotID": 1, "status": "accepted", "__v": 0 }, { "_id": "5fdceeae4cad453d6467fc06", "ID": 2, "senderID": 4, "receiverID": 3, "courseID": 2, "slotID": 2, "status": "pending", "__v": 0 } ]

Functionality: Accept or Reject Slot Linking Request

Route: /cc/handleSlotLinkingRequest
Request Type: POST
Request Body: { "requestID": 1, "decision": 1 } // 0 for rejected and 1 for accepted
Response: The Request is accepted sucessfully !

Functionality: Create Slot

Route: /cc/createSlot
Request Type: POST
Request Body: { "courseID": 1, "slot": {"slotNumber":3,"day":"monday","locationID":1} }
Response: Slot added sucessfully !

Functionality: delete Slot

Route: /cc/deleteSlot/:courseID/:slotID
Request Type: DELETE
Request Parameters slotID : the ID of the slot to be deleted , courseID : the ID of the course that has the to-be-deletd slot
Example how to call the route : /cc/deleteSlot/2/1
Response: The Slot has been deleted sucessfully

Functionality: update Slot

Route: /cc/updateSlot/:courseID/:slotID
Request Type: PUT
Request Parameters slotID : the ID of the slot to be updated , courseID : the ID of the course that has the to-be-updated slot
Example how to call the route : /cc/updateSlot/2/1
Request Body: the fields of the slot to be updated { "slotNumber" : 5 }
Response: The slot has been updated sucessfully !

Academic member functionality

Functionality: View Schedule

Route: /ac/viewSchedule
Request Type: GET
Request Body:
Response: The current week schedule of the academic member (Putting in consideration the replacement requests) Response Example: [{"courseID":2,"slot":{"ID":1,"slotNumber":1,"day":"sunday","locationID":1,"instructor":2}}]


Functionality: Send slot linking request

Route: /ac/sendSlotLinkingRequest
Request Type: POST
Request Body: { "slotID" : 2, "courseID" : 2 }
Response: "The request has been sent sucessfully" or an error message denoting the error.

Functionality: Send change day off request

Route: /ac/sendChangeDayOffRequest
Request Type: POST
Request Body: { "newDayOff" : "saturday", "msg" : "I need a vacation change" }
Response: "The request has been sent sucessfully" or an error message denoting the error.

Functionality: Get Notified on requests acceptance or rejection

Route: /ac/getAllNotifications
Request Type: GET
Response: [ { "_id": "5fdcc1431fbd6f07d46f0fc0", "senderID": 3, "receiverID": 4, "msg": "Your Slot Linking Request for the slot with ID 2 for the course CSEN401 is accepted", "date": "2020-12-18T14:48:35.008Z", "__v": 0 }, { "_id": "5fdcf25234ee0408843a217b", "senderID": 3, "receiverID": 4, "msg": "Your Slot Linking Request for the slot with ID 3 for the course CSEN401 is rejected", "date": "2020-12-18T18:17:54.407Z", "__v": 0 } ]

Functionality: View the status of all submitted requests and filter by accepted/rejected/pending

Route: /ac/viewAllRequests/:view
Request Type: GET
Request Parameters: view : parameter has values 0, 1, 2 or 3 depending on the applied filter type. The filters are namely (all : 0 , accepted : 1, rejected : 2, pending : 3).
Example how to call the route: /ac/viewAllRequests/1
Response: [ [], [], [], [], [], [], [], [ { "_id": "5fdcbc693f1a9333a81f075e", "ID": 1, "senderID": 4, "receiverID": 3, "courseID": 2, "slotID": 1, "status": "accepted", "__v": 0 } ] ]

Functionality: Send replacement request

Route: /ac/sendReplacementRequest
Request Type: POST
Request Body: {"replacementID" : 3, "courseID" : 2 , "slotID" : 1 , "requestedDate" : 1608807967732}
Note : the requested date must be in the same number format as the one returned from Data.now() in javascript and if you want to change the date to be in the future or the past you can doing the following code by adding the days you need to be added or subtracted from the cuurent day ,so the returned value from this function will be you input in the request body :

function generateDateFormat(addedOrsubtractedDays){
  var date = new Date(Date.now());
  var newDate = new Date();
  newDate.setDate(date.getDate() + addedOrsubtractedDays);
  return newDate.getTime();
} 

Response: "The replacement request has been sent sucessfully !" or an error message denoting the error.

Functionality: View replacement request

Route: /ac/viewReplacementRequests
Request Type: GET
Request Body:
Response: Array of the replacement requests.

Functionality: Respond to replacement request

Route: /ac/respondToReplacementRequest
Request Type: PUT
Request Body: {"requestID" : 1, "response" : 1}
Note : repsone == 1 == "accepted", repsone == 0 == "rejected"
Response: "Responded to replacement request successfully" or an error message denoting the error.

Functionality: Send maternity leave request

Route: /ac/sendMaternityLeaveRequest
Request Type: POST
Request Body: {"documents" : "https://google.com/ali", "startDate" :1608817862056, "endDate" : 1609250179792, "msg" : "Ali"}
Note : the start/end dates must be in the same number format as the one returned from Data.now() in javascript and if you want to change the date to be in the future or the past you can doing the following code by adding the days you need to be added or subtracted from the cuurent day ,so the returned value from this function will be you input in the request body :

function generateDateFormat(addedOrsubtractedDays){
  var date = new Date(Date.now());
  var newDate = new Date();
  newDate.setDate(date.getDate() + addedOrsubtractedDays);
  return newDate.getTime();
} 

Response: "The request has been created successfully." or an error message denoting the error.

Functionality: Send sick leave request

Route: /ac/sendSickLeaveRequest
Request Type: POST
Request Body: {"documents": "https://kabeel.com/doc.html", "requestedDate": 1608315083669, "msg" : "We won!" }
Note : the requestedDate date must be in the same number format as the one returned from Data.now() in javascript and if you want to change the date to be in the future or the past you can doing the following code by adding the days you need to be added or subtracted from the cuurent day ,so the returned value from this function will be you input in the request body :

function generateDateFormat(addedOrsubtractedDays){
  var date = new Date(Date.now());
  var newDate = new Date();
  newDate.setDate(date.getDate() + addedOrsubtractedDays);
  return newDate.getTime();
} 

Response: "The request has been created successfully." or an error message denoting the error.

Functionality: Send compensation leave request

Route: /ac/sendCompensationLeaveRequest
Request Type: POST
Request Body: {"absenceDate" : 1607804091516, "requestedDate" : 1607286318099, "msg" : "Hi I am here"}
Note : the absenceDate, requestedDate dates must be in the same number format as the one returned from Data.now() in javascript and if you want to change the date to be in the future or the past you can doing the following code by adding the days you need to be added or subtracted from the cuurent day ,so the returned value from this function will be you input in the request body :

function generateDateFormat(addedOrsubtractedDays){
  var date = new Date(Date.now());
  var newDate = new Date();
  newDate.setDate(date.getDate() + addedOrsubtractedDays);
  return newDate.getTime();
} 

Response: "The compensation request is sent successfully." or an error message denoting the error.

Functionality: Send Annual leave request

Route: /ac/sendAnnualLeaveRequest
Request Type: POST
Request Body: {"requestedDate" : 1607286318099, "msg" : "Hi I am here"}
Note : the requestedDate dates must be in the same number format as the one returned from Data.now() in javascript and if you want to change the date to be in the future or the past you can doing the following code by adding the days you need to be added or subtracted from the cuurent day ,so the returned value from this function will be you input in the request body :

function generateDateFormat(addedOrsubtractedDays){
  var date = new Date(Date.now());
  var newDate = new Date();
  newDate.setDate(date.getDate() + addedOrsubtractedDays);
  return newDate.getTime();
}

Response: "the annual leave request has already sucessfully created !" or an error message denoting the error.

Functionality: Send accidental leave request

Route: /ac/sendAccidentalLeaveRequest
Request Type: POST
Request Body: {"requestedDate" : 1608324670255 , "msg" : "Please accept my request"}
Note : the requestedDate date must be in the same number format as the one returned from Data.now() in javascript and if you want to change the date to be in the future or the past you can doing the following code by adding the days you need to be added or subtracted from the cuurent day ,so the returned value from this function will be you input in the request body :

function generateDateFormat(addedOrsubtractedDays){
  var date = new Date(Date.now());
  var newDate = new Date();
  newDate.setDate(date.getDate() + addedOrsubtractedDays);
  return newDate.getTime();
} 

Response: "The accidental leave request created successfully" or an error message denoting the error.

Functionality: Cancel compensation leave request

Route: /ac/cancelCompensationLeaveRequest/:ID
Request Type: DELETE
Request Parameters: The ID of the compensation leave request that the academic member wants to cancel.
Example of how to call the route: /ac/cancelCompensationLeaveRequest/5

Functionality: Cancel sick leave request

Route: /ac/cancelSickLeaveRequest/:ID
Request Type: DELETE
Request Parameters: The ID of the sick leave request that the academic member wants to cancel.
Example of how to call the route: /ac/cancelSickLeaveRequest/3

Functionality: Cancel maternity leave request

Route: /ac/cancelMaternityLeaveRequest/:ID
Request Type: DELETE
Request Parameters: The ID of the maternity leave request that the academic member wants to cancel.
Example of how to call the route: /ac/cancelMaternityLeaveRequest/1

Functionality: Cancel change day off request

Route: /ac/cancelChangeDayOffRequest/:ID
Request Type: DELETE
Request Parameters: The ID of the change day off leave request that the academic member wants to cancel.
Example of how to call the route: /ac/cancelChangeDayOffRequest/1

Functionality: Cancel replacement request

Route: /ac/cancelReplacementRequest/:ID
Request Type: DELETE
Request Parameters: The ID of the replacement request that the academic member wants to cancel.
Example of how to call the route: /ac/cancelReplacementRequest/1

Functionality: Cancel slot linking request

Route: /ac/cancelSlotLinkingRequest/:ID
Request Type: DELETE
Request Parameters: The ID of the slot linking request that the academic member wants to cancel.
Example of how to call the route: /ac/cancelSlotLinkingRequest/1

Functionality: Cancel Accidental Leave request

add 'auth-token' of academic member
Route: /ac/cancelAccidentalLeaveRequest
Request Type: DELETE
Request Body: ID of the request
{"ID":2}
Response: request has been deleted succuessfully

Functionality: Cancel Annual Leave request

add 'auth-token' of academic member
Route: /ac/cancelAnnualLeaveRequest
Request Type: DELETE
Request Body: ID of the request
{"ID":2}
Response: request has been deleted succuessfully

-div-elopers-1's People

Contributors

amanallahrafat avatar sarahmed avatar slmakh avatar mohamedk1 avatar alikabeel avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.