-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.txt
1455 lines (1244 loc) · 43.6 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Team-2
1. Which file should be run to launch the server of your project and under which folder (if
not in the root)?
The file that should be run is the app.js. It is under the root.
2. Which port is the server listening to?
The server is listening to port 3000.
3. Write npm run dev in the terminal to run the server
4. Paste your mongoDB cnnection string in the config/default.json to connect to your database
5. There are FIVE routes that need to be run to seed the database (not all of them at once).
a) localhost:3000/api/init/academic-coordinator. This route is responsible to insert ALL the data need so you can be able to test the academic member and coordinator routes. Once the data is inserted, you can use postman to copy our examples and you will see the same response that is written in the readme file.
b)localhost:3000/api/init/staffMems. This route is responsible to insert ALL the data need so you can be able to test the staff member routes. Once the data is inserted, you can use postman to copy our examples and you will see the same response that is written in the readme file.
c)localhost:3000/api/init/hod-init. This route is responsible to insert ALL the data need so you can be able to test the HOD routes. Once the data is inserted, you can use postman to copy our examples and you will see the same response that is written in the readme file.
d)localhost:3000/api/init/courseInstructor. This route is responsible to insert ALL the data need so you can be able to test the course instructor routes. Once the data is inserted, you can use postman to copy our examples and you will see the same response that is written in the readme file.
e)localhost:3000/api/init/hr-init. This route is responsible to insert ALL the data need so you can be able to test the HR routes. Once the data is inserted, you can use postman to copy our examples and you will see the same response that is written in the readme file.
=======
6. THE MOST IMPORTANT NOTE: WHEN YOU RUN THE SEEDING ROUTE, IT AUTOMATICALLY CLEARS THE DATABASE. THEREFORE, PLEASE DO NOT RUN ALL FIVE SEEDING ROUTES AT THE BEGINING. WHENEVER YOU NEED TO TEST A PART, JUST RUN ITS SEEDING ROUTE BEFORE TESTING IT.
7. IMPORTANT NOTE: TO BE ABLE TO USE THE COURSE COORDINATOR ROUTES, PLEASE USE THE /api/login ROUTE TO LOGIN USING EMAIL:[email protected] AND PASSWORD: 12345
8. IMPORTANT NOTE: TO BE ABLE TO USE THE ACADEMIC MEMBERS ROUTES, PLEASE USE THE /api/login ROUTE TO LOGIN USING EMAIL:[email protected] AND PASSWORD: 12345
9. IMPORTANT NOTE: TO BE ABLE TO USE THE HEAD OF DEPARTMENT ROUTES, PLEASE USE THE /api/login ROUTE TO LOGIN USING EMAIL:[email protected] AND PASSWORD: SlimSlim
10. IMPORTANT NOTE: TO BE ABLE TO USE THE COURSE INSTRUCTOR ROUTES, PLEASE USE THE /api/login ROUTE TO LOGIN USING EMAIL:[email protected] AND PASSWORD: 12345
11. You will find the UML in the root (UML.jpg)
12. # You will find below the description of each route. When you are testing our routes, you can copy the examples written in this document in postman. When you run the routes, you will get a response. The response you get should be identical to the response written in the examples here. That way, you can verify that our work is working correctly
=================================================================================
--------------------------------staffMembers-------------------------------------
=================================================================================
Functionality: Logs the staff member in
Route: /api/login
Request type: POST
Request Body: {"email":"[email protected]",
"password":"passwordsha2y"}
---
Functionality: Logs the staff member out
Route: /api/staffs/logout
Request type: POST
---
Functionality: Views the profile of the staff member
Route: /api/staffs/profile
Request type: GET
Response: JSON Object containing staff member details
Example: {
"Name": "7amada sha3r",
"Email": "[email protected]",
"ID": "43-8530",
"Office": "C4.404",
"FacultyName": "Tegara",
"DepartmentName": "Fawanees",
"Courses": [
"ABC123",
"XYZ567"
],
"DayOff": "SAT",
"annualLeaves": 5,
"Salary": 10
}
---
Functionality: Updates the profile of a staff member with the entered data
Route: /api/staffs/profile/update
Request type: PUT
Request Body: {
"email":"[email protected]",
"office":"C6.606",
"faculty":"Zaboota",
"department":"Mo5abarat",
"salary":10000
}
NOTE: faculty, department & salary only update in the DB only if the logged in member is not "academic"
---
Functionality: Resets the password of the staff member
Route: /api/staffs/passwordreset
Request type: PUT
Request Body: {
"oldpassword":"passwordsha2y",
"newpassword":"passwordmeshsha2y"
}
---
Functionality: Signs the staff member in to mark their attendance
Route: /api/staffs/signin
Request type: POST
Response: Returns the overall attendance record
Example: [
{
"op": "sign in",
"time": "2020-12-20T14:08:31.848Z"
}
]
NOTE: The sign in & sign out routes will not work unless the current time of signing in or out is within the working hours
---
Functionality: Signs the staff member out to mark them leaving
Route: /api/staffs/signout
Request type: POST
Response: Returns the overall attendance record
Example: [
{
"op": "sign in",
"time": "2020-12-20T14:08:31.848Z"
},
{
"op": "sign out",
"time": "2020-12-20T14:09:30.180Z",
"net": -503.8235833333333
}
]
---
Functionality: Views the attendance of the staff member for a specified month
Route: /api/staffs/attendance/:month
Request type: GET
Parameters: month is the month of the attendance viewed
Example of how to call the route: /attendance/12
Response: Array of JSON Objects representing the attendance in the specified month
Example: [
{
"op": "sign in",
"time": "2020-12-20T13:22:18.145Z"
},
{
"op": "sign out",
"time": "2020-12-20T13:22:28.730Z",
"net": -503.8235833333333
},
{
"op": "sign in",
"time": "2020-12-20T13:22:36.920Z"
},
{
"op": "sign out",
"time": "2020-12-20T13:22:41.698Z",
"net": 0.07963333333333333
},
{
"op": "sign in",
"time": "2020-12-20T14:02:05.071Z"
},
{
"op": "sign out",
"time": "2020-12-20T14:03:11.430Z",
"net": 1.1059833333333333
}
]
---
Functionality: Views the overall attendance
Route: /api/staffs/attendance
Request type: GET
Response: Array of JSON Objects representing the attendance
Example: [
{
"op": "sign in",
"time": "2020-12-20T13:22:18.145Z"
},
{
"op": "sign out",
"time": "2020-12-20T13:22:28.730Z",
"net": -503.8235833333333
},
{
"op": "sign in",
"time": "2020-12-20T13:22:36.920Z"
},
{
"op": "sign out",
"time": "2020-12-20T13:22:41.698Z",
"net": 0.07963333333333333
},
{
"op": "sign in",
"time": "2020-12-20T14:02:05.071Z"
},
{
"op": "sign out",
"time": "2020-12-20T14:03:11.430Z",
"net": 1.1059833333333333
}
]
---
Functionality: Views the days missed by a staff member (that was not signed) where it was not neither a dayoff nor a friday
Route: /api/staffs/missingdays
Request type: GET
Response: Array of the days missed
Example: [
"12/12",
"13/12",
"14/12",
"15/12",
"16/12",
"17/12",
"19/12"
]
---
Functionality: Views the net missing hours of the current month
Route: /api/staffs/missinghours
Request type: GET
Response: The number of missing hours
Example: -8 Hours -22 Mins
---
=================================================================================
---------------------------courseCoordinatorRoutes-------------------------------
=================================================================================
To begin testing you will need a token. To get the token, send a post request using use the "/api/login" route with
the follow body:
{
"email":"[email protected]",
"password":"12345"
}
then the token will be returned in the header. For any upcoming request, include
the returend token in the header of the request to authenticate.
---
Functionality: View "slot linking" request(s) from academic members linked to his/her course.
Route: /api/coordinator/slotLinkingRequest
Request type: GET
Response: Array of "slot linking" request objects sent from academic members linked to his/her course.
Example:
[
{
"request sent by": "Shaka",
"requestType": "slot linking",
"status": "pending",
"Desired slot": {
"startTime": "2020-12-20T10:08:15.000Z",
"endTime": "2020-12-20T10:09:45.000Z",
"courseTaughtInSlot": "CSEN701: Embedded Systems",
"slotLocation": "H14"
}
}
]
---
Functionality: Accept/reject \slot linking" requests from academic members linked to his/her cours
Route: /api/coordinator/acceptRejectslotLinkingRequest
Request type: POST
Request body:
{
"requestID":"5fdf4da964feaf10444d8c26",
"coursename":"CSEN701: Embedded Systems"
}
Response: A statement indicating acceptance of request or rejection with reason for rejection.
Example: "accepted" OR "Rejected because you are already teaching a slt during the same time" OR "Rejected because some other staff member is already teaching this slot" OR "Rejected because this is not a slot in course" OR
NOTES (PLEASE READ VERRRRRRRRRRYYYYYY IMPORTANT!!!!!!!!!!!!!!!!):
"requestID" is the object ID assigned by mongoose when the request object was created and placed in the request collection. It represents the object id of the request that the course coordinator wants to accept/reject.
## THE REQUESTID WILL DIFFER EVERYTIME YOU SEED THE DATABASE. THERE IT WONT ALWAYS BE "5fdf4da964feaf10444d8c26". CHECK THE DATABASE FOR THE CORRECT REQUEST ID.
---
Functionality: Add course slot(s) in his/her course
Route: /api/coordinator/addCourseSlot
Request type: POST
Request body:
{
"courseName":"CSEN701: Embedded Systems",
"startTime":"2020-12-20T14:13:45",
"endTime":"2020-12-20T14:15:15",
"slotLocation":"H14"
}
Response: Returns the newly created slot
Example:
{
"startTime": "2020-12-20T12:13:45.000Z",
"endTime": "2020-12-20T12:15:15.000Z",
"courseTaughtInSlot": "CSEN701: Embedded Systems",
"slotLocation": "H14"
}
---
Functionality: Updates course slot(s) in his/her course (By updating I mean he can change the location of the slot or the staff member teaching the slot).
Route: /api/coordinator/updateCourseSlot
Request type: PUT
Request Body:
{
"courseName":"CSEN701: Embedded Systems",
"slotID":"5fdfc265685d492a48fbd303",
"staffTeachingSlot":"Ali",
"slotLocation":"H14"
}
Response: the mongoose record of the updated slot
Example:
{
"startTime": "2020-12-20T10:10:00.000Z",
"endTime": "2020-12-20T10:11:30.000Z",
"courseTaughtInSlot": "CSEN701: Embedded Systems",
"staffTeachingSlot": "Ali",
"slotLocation": "H14"
}
NOTES (PLEASE READ VERRRRRRRRRRYYYYYY IMPORTANT!!!!!!!!!!!!!!!!):
"slotID" is the object ID assigned by mongoose when the slot object was created and placed in the slot collection. It represents the object id of the slot that the course coordinator wants to update.
## THE SLOTID WILL DIFFER EVERYTIME YOU SEED THE DATABASE. THERE IT WONT ALWAYS BE "5fdf4da964feaf10444d8c26". CHECK THE DATABASE FOR THE CORRECT SLOTID OF ONE OF SLOTS BELONGING TO THE EMBEDDED SYSTEMS COURSE.
Functionality: Delete course slot(s) in his/her course.
Route: /api/coordinator/deleteCourseSlot
Request type: POST
Request Body: {
"courseName":"CSEN701: Embedded Systems",
"slotID":"5fde6e9457ea432df038adc7"
}
Response: statement idicating that slot has been successfully deleted
Example: "Successfully deleted slot"
NOTES (PLEASE READ VERRRRRRRRRRYYYYYY IMPORTANT!!!!!!!!!!!!!!!!):
"slotID" is the object ID assigned by mongoose when the slot object was created and placed in the slot collection. It represents the object id of the slot that the course coordinator wants to delete.
THE SLOTID WILL DIFFER EVERYTIME YOU SEED THE DATABASE. THERE IT WONT ALWAYS BE "5fdf4da964feaf10444d8c26". CHECK THE DATABASE FOR THE CORRECT SLOTID OF ONE OF SLOTS BELONGING TO THE EMBEDDED SYSTEMS COURSE.
=================================================================================
-----------------------------academicMemberRoutes--------------------------------
=================================================================================
To begin testing you will need a token. To get the token, send a post request using use the "/api/login" route with
the follow body:
{
"email":"[email protected]",
"password":"12345"
}
then the token will be returned in the header. For any upcoming request, include
the returend token in the header of the request to authenticate.
# PLEASE RERUN localhost:3000/api/init/academic-coordinator AGAIN
----------------------------------------------------------------------------------
Functionality: Academic member views their own schedule, seeing their teaching activities and replacements (if present).
Route: /api/academicMember/schedule
Request type: GET
Response: Array containing JSON objects representing the slots.
Example:
[
{
"day": 5,
"slotNr": 1,
"startTime": "2020-12-20T10:10:00.000Z",
"endTime": "2020-12-20T10:11:30.000Z",
"courseTaughtInSlot": "CSEN701: Embedded Systems",
"staffTeachingSlot": "Shaka",
"slotLocation": "H14",
"replacementStaff": "NA"
}
]
---
Functionality: Sending replacement requests
Route: /api/academicMember/replacementRequest
Request type: POST
Request Body:
{
"sendingRequestTo": "Ali",
"slotID": "5fe492c9783a150ac4c7d873",
"dayForWhichINeedAReplacement": "2021-12-20T10:10:00.000Z"
}
Response: Returns a mongoose record representing the newly created request.
Example:
{
"Request sent by": "Shaka",
"Request sent to": "Ali",
"Type of request": "Replacement request",
"Status": "Pending",
"Slot to be replaced": {
"startTime": "2020-12-20T10:10:00.000Z",
"endTime": "2020-12-20T10:11:30.000Z",
"course taught in slot": "CSEN701: Embedded Systems",
"staff member teaching slot": "Shaka",
"slotLocation": "H14"
},
"Date of replacement": "2021-12-20T10:10:00.000Z"
}
# NOTES (PLEASE READ VERRRRRRRRRRYYYYYY IMPORTANT!!!!!!!!!!!!!!!!):
# "slotID" is the object ID assigned by mongoose when the slot object was created and placed in the slot collection. It represents the object id of the slot that the academic member wants to find a replacement for
# THE SLOTID WILL DIFFER EVERYTIME YOU SEED THE DATABASE. THERE IT WONT ALWAYS BE "5fdf4da964feaf10444d8c26". CHECK THE DATABASE FOR THE CORRECT SLOTID OF ONE OF SLOTS BEING TAUGHT BY TA SHAKA.
---
Functionality: View "replacement" request(s) sent to me from other academic staff members
Route: /api/academicMember/replacementRequest
Request type: GET
Response: An array of JSON objects representing the replacement requests sent from other academic staff members
Example:
[
{
"request sent by": "Ali",
"requestType": "replacement",
"status": "pending",
"replacementSlot": {
"startTime": "2020-12-20T10:10:00.000Z",
"endTime": "2020-12-20T10:11:30.000Z",
"course taught in slot": "CSEN701: Embedded Systems",
"staff member teaching slot": "Ali",
"slotLocation": "H14"
}
}
]
---
Functionality: Accept a replacement request sent from another academic staff member
Route: /api/academicMember/acceptReplacementRequest
Request type: POST
Request Body:
{
"requestID": "5fe4a640f667a61d54ccc13f"
}
Response: Statement indicating the acceptance of the replacement request
Example: "Accepted"
NOTE:
THE REQUESTID WILL DIFFER EVERYTIME YOU SEED THE DATABASE. THERE IT WONT ALWAYS BE "5fdf4da964feaf10444d8c26". CHECK THE DATABASE FOR THE CORRECT REQUESTID OF ONE OF REQUESTS SENT TO TA SHAKA BY TA ALI.
---
Functionality: Reject a replacement request sent from another academic staff member
Route: /api/academicMember/rejectReplacementRequest
Request type: POST
{
"requestID": "5fe4a640f667a61d54ccc13f"
}
Response: Statement indicating the rejection of the replacement request
Example: "Rejected"
# NOTE:
# THE REQUESTID WILL DIFFER EVERYTIME YOU SEED THE DATABASE. THERE IT WONT ALWAYS BE "5fdf4da964feaf10444d8c26". CHECK THE DATABASE FOR THE CORRECT REQUESTID OF ONE OF REQUESTS SENT TO TA SHAKA BY TA ALI.
# use the same request that you used in the previous route. Just changed the accepted status to pending in the database and call this route.
---
Functionality: Send a "slot linking" request to course coordinator
Route: /api/academicMember/slotLinkingRequest
Request type: POST
Request body:
{
"slotID":"5fe4a63ff667a61d54ccc13a"
}
Response: Returns the newly created replacement object
Example:
{
"Request sent by": "Shaka",
"requestType": "slot linking",
"status": "pending",
"replacementSlot": {
"startTime": "2020-12-20T10:08:15.000Z",
"endTime": "2020-12-20T10:09:45.000Z",
"course taught in slot": "CSEN701: Embedded Systems",
"slotLocation": "H14"
}
}
# NOTES:
# "slotID" is the object ID assigned by mongoose when the slot object was created and placed in the slot collection. It represents the object id of the slot that te academic member desires to teach/link to.
# THE SLOTID WILL DIFFER EVERYTIME YOU SEED THE DATABASE. THERE IT WONT ALWAYS BE "5fdf4da964feaf10444d8c26". CHECK THE DATABASE FOR THE CORRECT SLOTID OF ONE OF A SLOT DOESNT HAVE A TA TEACHING IN IT.
---
Functionality: Change their day off by sending a "change day off" request to HOD,
and optionally leave a reason.
Route: /api/academicMember/changeDayOffRequest
Request type: POST
Request body:
{
"reasonForChange":"I love eating chocolate cake on Sataurday and I can't eat chocolate cake at uni",
"desiredDayOff":"SAT"
}
Response: Returns the newly created "change day off" request object
Example:
{
"Sent by": "Shaka",
"Recieved by": "Slim (HOD)",
"requestType": "change day off",
"status": "pending",
"DesiredDayOff": "SAT",
"requestReason": I love eating chocolate cake on Sataurday and I can't eat chocolate cake at uni
}
---
Functionality: Submit any type of "leave" request (automatically sent to HOD)
Route: /api/academicMember/leave
Request type: POST
Request body:
{
"documents":"https://drive.google.com/file/d/1soJJpBRjlzuVOs8GsGv5lbeLUP3k6MwK/view?usp=sharing",
"reason":"Was very very sick and I thought that I was going to die",
"leaveType":"sick leave",
"replacementStaff":"Loaa Zahar",
"startOfLeave":"01.02.2012",
"endOfLeave":"01.05.2012"
}
Response: Returns the newly created "leave" request object
Example:
{
"Leave request sent by": "Shaka",
"Leave request sent to": "Slim (HOD)",
"status": "pending",
"replacementStaffName": "Loaa Zahar",
"relaventLeaveDocuments": "https://drive.google.com/file/d/1soJJpBRjlzuVOs8GsGv5lbeLUP3k6MwK/view?usp=sharing",
"requestReason": "Was very very sick and I thought that I was going to die",
"startOfLeave": "01.02.2012",
"endOfLeave": "01.05.2012"
}
---
Functionality: View the status of all submitted requests.
Route: /api/academicMember/requestStatus
Request type: GET
Response: Array of JSON Objects representing the submitted requests
Example:
[
{
"request sent to": "Ali",
"requestType": "slot linking",
"status": "pending"
},
{
"request sent to": "Ali",
"requestType": "replacement",
"status": "pending"
},
{
"request sent to": "Slim",
"requestType": "change day off",
"status": "rejected"
},
{
"request sent to": "Slim",
"requestType": "change day off",
"status": "accepted"
}
]
---
Functionality: View the status of accepted submitted requests.
Route: /api/academicMember/requestStaus/accepted
Request type: GET
Response: Array of JSON Objects representing the accepted submitted requests
Example:
[
{
"request sent to": "Ali",
"requestType": "replacement",
"status": "accepted"
},
{
"request sent to": "Slim",
"requestType": "change day off",
"status": "accepted"
}
]
---
Functionality: View the status of rejected submitted requests.
Route: /api/academicMember/requestStaus/rejected
Request type: GET
Response: Array of JSON Objects representing the rejected submitted requests
Example:
[
{
"request sent to": "Slim",
"requestType": "change day off",
"status": "rejected"
}
]
---
Functionality: View the status of pending submitted requests.
Route: /api/academicMember/requestStaus/pending
Request type: GET
Response: Array of JSON Objects representing the pending submitted requests
Example:
[
{
"request sent to": "Ali",
"requestType": "slot linking",
"status": "pending"
},
{
"request sent to": "Ali",
"requestType": "replacement",
"status": "pending"
}
]
---
Functionality: Cancel a still pending request or a request whose day is yet to come
Route: /api/academicMember/cancleRequest
Request type: POST
Request body:
{
"requestID": "5fdf0f28ae6eb318c8c0621f"
}
Response: A statement that indicates that the deletion process was successful
Example: "Successfully deleted"
# NOTE: AGAIN PLEASE GET CORRECT ID FROM DB
=================================================================================
----------------------------HeadOfDepartmentRoutes-------------------------------
=================================================================================
/////// VERY IMPORTANT NOTES \\\\\\\\\\
1. Before testing these routes, please send a "get" request to < "http://localhost:3000/api/init/hod-init" > to seed the database.
2. I did my best to have it so you don't have to get an ObjectId from the Database, and tried to use constant values for the req.body
3. Seeding will add the following items.
-One faculty "Engineering"
-One Department "MET" under "Engineering" Faculty
-One course "CSEN 701 - Embedded Systems" under MET department, with two teaching slots,
1 of which is unassigned.
-Three "instructor" subType users. ("Slim","ac-1")|("Hassan Soubra","ac-2")|("Milad Ghantous","ac-3")
where "Slim" is Head of "MET" department.
-One "ta" subType user. ("Ahmed Hesham", "ac-4"), which is a TA for course "CSEN 701 - Embedded
Systems".
-Two locations (C6.304,lab), (C6.305,tutorial)
-Two slots (location: C6.304, not assigned to anyone)
and (location: C6.305, assigned to instructor "Hassan Soubra")
-One Request of type "annual leave" from "Hassan Soubra" to "Slim"
4. You will need to use the "http://localhost:3000/api/login/" route to log in as "Slim" the head of the department, in order to get his token to conduct tests
Slim's login info ==> { email : [email protected]
password : SlimSlim }
5. After logging in as Slim, take his token from the response header in postman, and use it in the request header of all the routes below
6. Finally, I exported all my postman tests to a collection file, which you might be able to import. You'll find it in the project directory in "postman-collection/HOD-Tests.postman_collection.json".
Thought it might save you some time :)
---
Functionality: HOD can assign a course instructor to a course in his department.
Route: '/api/hod/assign-instr-course'
Request type: POST
Request body:
{
"courseName": "CSEN 701 - Embedded Systems",
"instructorId": "ac-2"
}
Response: Statement to indicate assignment
Response Example:
"HOD user: Slim made change ==> instructor Hassan Soubra is now assigned to course CSEN 701 - Embedded Systems."
---
---
Functionality: HOD can remove a course instructor from a course in his department.
Route: '/api/hod/del-instr-course'
Request type: DELETE
Request body:
{
"courseName": "CSEN 701 - Embedded Systems",
"instructorId": "ac-2"
}
Response: Statement to indicate deletion
Response Example:
"HOD user: Slim made change ==> instructor Hassan Soubra is now removed from course CSEN 701 - Embedded Systems."
---
---
Functionality: HOD can update a course instructor for one of his courses
Note:
==> since assignment and removal of instructor to course are already implemented, and since your
==> description is very vague about this, I decided to implement update as in an OverWriting
==> Assignment. (i.e. make the instructor given in body the only instructor )
Route: '/api/hod/update-instr-course'
Request type: POST
Request body:
{
"courseName": "CSEN 701 - Embedded Systems",
"instructorId": "ac-1"
}
Response: Statement to indicate update
Response Example:
"HOD user: Slim made change ==> instructor Slim is now assigned to course CSEN 701 - Embedded Systems (Overwritingly)."
---
---
Functionality: HOD can view all staff members in his department.
Route: '/api/hod/staff'
Request type: GET
Response: All staff members in his department's names ,emails , ids(userCode) , and subType
Note: (I'm just using userCode ^^ to avoid confusion between "\_id" and "id", "\_id" is the mongoose ObjectId, and "id" is the user's id like "ac-33")
Response Example:
[
{
"userCode": "ac-1",
"subType": "head of department",
"email": "[email protected]",
"name": "Slim"
},
{
"userCode": "ac-2",
"subType": "instructor",
"email": "[email protected]",
"name": "Hassan Soubra"
},
{
"userCode": "ac-3",
"subType": "instructor",
"email": "[email protected]",
"name": "Milad Ghantous"
},
{
"userCode": "ac-4",
"subType": "ta",
"email": "[email protected]",
"name": "Ahmed Hesham"
}
]
---
---
Functionality: HOD can view all staff members for a course in his department.
Route: '/api/hod/staff-crs'
Request type: GET
Request body:
{
"courseName": "CSEN 701 - Embedded Systems"
}
Response: Staff members' names, emails, ids(userCode) , subTypes
Response Example:
[
{
"userCode": "ac-1",
"subType": "head of department",
"email": "[email protected]",
"name": "Slim"
},
{
"userCode": "ac-4",
"subType": "ta",
"email": "[email protected]",
"name": "Ahmed Hesham"
}
]
---
---
Functionality: HOD can view all staff members in his department's day offs.
Route: '/api/hod/staff-do'
Request type: GET
Response: array of objects containing All staff members' id, name, day off.
Response Example:
[
{
"id": "ac-1",
"staffMemberName": "Slim",
"subType": "head of department",
"dayOff": "SAT"
},
{
"id": "ac-2",
"staffMemberName": "Hassan Soubra",
"subType": "instructor",
"dayOff": "SAT"
},
{
"id": "ac-3",
"staffMemberName": "Milad Ghantous",
"subType": "instructor",
"dayOff": "TUE"
},
{
"id": "ac-4",
"staffMemberName": "Ahmed Hesham",
"subType": "ta",
"dayOff": "MON"
}
]
---
---
Functionality: HOD can view a single staff members in his department's day offs.
Route: '/api/hod/staff-dos'
Request type: GET
Request body:
{
"staffId": "ac-2"
}
Response: object containing the staff members' id, name, day off.
Response Example:
{
"id": "ac-2",
"staffMemberName": "Hassan Soubra",
"subType": "instructor",
"dayOff": "SAT"
}
---
---
Functionality: HOD can view all the requests “change day off/leave” sent by staff members in his/her department
Route: '/api/hod/leave-do-reqs'
Request type: GET
Response: Array of Objects, each object containing a request's information (for all requests sent by staffMembers in HOD's department)
Response Example:
[
{
"requestId": "5fe50013460d320d2c04e06d",
"reqSenderId": "ac-2",
"reqSenderName": "Hassan Soubra",
"reqRecieverId": "ac-1",
"reqRecieverName": "Slim",
"requestReason": "My horse is stuck in a fridge",
"status": "pending",
"startOfLeave": "2020-12-24T20:54:43.904Z",
"endOfLeave": "2020-12-24T20:54:43.904Z",
"replacementSlot": "5fe50011460d320d2c04e06b"
}
]
---
---
Functionality: HOD can Accept a <leave> or <change day off> request.
Note:
==> I didn't put a limit that you can't accept an already rejected request. only because I thought HOD
should have option to change his mind later.
==> Also, sadly there's no unique identifier for request so you have to get ObjectId for this one manually
from the DB to test
Route: '/api/hod/leave-do-req-a'
Request type: POST
Request body:
{
"reqId" : "5fe50013460d320d2c04e06d"
}
Response: Indication of operation success
Response Example:
"Request Acceptance successful!"
---
---
Functionality: HOD can Decline a <leave> or <change day off> request.
Note:
==> Same as with accept, I didn't put a limit that you can't reject an already accepted request. Only
because I thought HOD should have option to change his decision.
==> Also, sadly there's no unique identifier for request so you have to get ObjectId for this one manually
from the DB to test
Route: '/api/hod/leave-do-req-r'
Request type: POST
Request body: note that reqRejectReason field is OPTIONAL, and could be removed
{
"reqId" : "5fe50013460d320d2c04e06d",
"reqRejectReason" : "my house is on fire"
}
Response: Indication of operation success
Response Example:
"Request Rejection successful!"
---
---
Functionality: HOD can view Course Coverage for course in his department
Route: '/api/hod/course-cov'
Request type: GET
Request body:
{
"courseName": "CSEN 701 - Embedded Systems"
}
Response: The course coverage of the course in %, and the number of unassigned slots
Response Example:
"course CSEN 701 - Embedded Systems has coverage 50%, and 1 unassigned slots"
---
---
Functionality: HOD can view Teaching Assignment for course in his department
Route: '/api/hod/teaching-assignments'
Request type: GET
Request body:
{
"courseName": "CSEN 701 - Embedded Systems"
}
Response: The slots of the course, their general info, whether they're assigned to someone or not, and if they are, then the person they are assigned to.
Response Example:
[
{
"slotId": "5fe50011460d320d2c04e06b",
"startTime": "2020-12-24T20:54:41.245Z",
"endTime": "2020-12-24T20:54:41.245Z",
"location": "C6.304",
"isAssigned": false
},
{
"slotId": "5fe50012460d320d2c04e06c",
"startTime": "2020-12-24T20:54:42.061Z",
"endTime": "2020-12-24T20:54:42.061Z",
"location": "C6.305",
"isAssigned": true,
"staffTeachingSlotId": "ac-2",
"staffTeachingSlotSubType": "instructor",
"staffTeachingSlotName": "Hassan Soubra"
}
]
---
===========================================================================================================
---------------------------------------------courseInstructorRoutes----------------------------------------
===========================================================================================================
To begin testing you will need a token. To get the token, send a post request using use the "/api/login" route with
the follow body:
{
"email":"[email protected]",
"password":"12345"
}
then the token will be returned in the header. For any upcoming request, include
the returned token in the header of the request to authenticate.
----------------------------------------------------------------------------------
Functionality: View the coverage of course(s) current instructor is assigned to.
Route: /api/instructor/view-course-coverage/:course
Parameters: course is the name of the course that the instructor teaches and that we want to get the course coverage of
Example of how to call the route: /api/instructor/view-course-coverage/CSEN605: DSD
Request type: GET
Response: The course coverage of a specific course that the instructor teaches
Response Example:
Course coverage of this course is 0.5%
Note: this route is used to get the course coverage for a particular course. To get the course coverage of ALL courses that the instructor teaches, just call this route for every single course
---
---
Functionality: View the slots asignment of course(s) course instructror is assigned to.
Route: /api/instructor/view-slot-assign-course/:course
Parameters: course is the name of the course that the instructor teaches and that he wants to see the slot assignment of
Example of how to call the route: /api/instructor/view-slot-assign-course/CSEN605: DSD
Request type: GET
Response: JSON file containing the slots assignments of a course that an instuctor is assigned to
Response Example:
[
{
"startTime": "2020-12-20T10:10:00.000Z",
"endTime": "2020-12-20T10:11:30.000Z",
"staff assigned to course": "Slot not assigned yet"
},
{
"startTime": "2020-12-20T10:08:00.000Z",
"endTime": "2020-12-20T10:09:30.000Z",
"staff assigned to course": "Hassan Soubra"