Skip to content

Commit 4e06155

Browse files
Merge branch 'development' into 260-create-apidoc-for-practical
2 parents 09a691f + 1213e8e commit 4e06155

32 files changed

+1720
-41
lines changed

.eslintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
es2021: true,
55
jest: true
66
},
7-
extends: "airbnb-base",
7+
extends: ["airbnb-base", "prettier"],
88
overrides: [],
99
parserOptions: {
1010
ecmaVersion: "latest",

.prettierignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
**/node_modules
2+
**/apidoc
3+
**/.git
4+
**/_apidoc.js
5+
**/*.json
6+
**/*.css
7+
Dockerfile

.prettierrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2-
"singleQuote": true,
3-
"tabWidth": 2
2+
"singleQuote": false,
3+
"tabWidth": 2,
4+
"semi": true
45
}
File renamed without changes.

_apidoc.js

Lines changed: 282 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,3 +764,285 @@
764764
*
765765
* @apiError (Error 400) {String} err Error message for bad requests.
766766
*/
767+
768+
// ------------------------------------------------------------------------------------------
769+
// Group.
770+
// ------------------------------------------------------------------------------------------
771+
772+
/**
773+
* @api {post} /group/add Add Group
774+
* @apiName AddGroup
775+
* @apiGroup Group
776+
* @apiDescription Add a new group.
777+
*
778+
* @apiBody {String} title Group title.
779+
* @apiBody {ObjectId[]} students Array of student ObjectIDs.
780+
*
781+
* @apiSuccess {String} res Response message.
782+
* @apiError (Error 500) GroupAddError Error while adding the group
783+
*
784+
* @apiSuccessExample Success-Response:
785+
* HTTP/1.1 200 OK
786+
* {
787+
* "res": "added group Example Group"
788+
* }
789+
*
790+
* @apiErrorExample Error-Response:
791+
* HTTP/1.1 500 Internal Server Error
792+
* {
793+
* "err": "Error while inserting in DB"
794+
* }
795+
*/
796+
797+
// ------------------------------------------------------------------------------------------
798+
// Semester
799+
// ------------------------------------------------------------------------------------------
800+
/**
801+
* @api {post} /semester/add Request to add Semester information
802+
* @apiName Addsemester
803+
* @apiGroup Semester
804+
*
805+
* @apiQuery {Number} [number] Number of semester
806+
* @apiQuery {String} [academicYear] To show the current academic year
807+
* @apiQuery {String} [type] Stores the enum ODD or EVEN for semester
808+
* @apiQuery {Date} [startDate] Start date of the semester
809+
* @apiQuery {Date} [endDate] End date of the semester
810+
*
811+
* @apiSuccess {String} res Response message .
812+
* @apiError (Error 500) DatabaseError Err message if there is an error inserting into the database.
813+
*
814+
*/
815+
816+
/**
817+
* @api {get} /semester/list Request to list Semester information
818+
* @apiName semesterlist
819+
* @apiGroup Semester
820+
*
821+
* @apiQuery {Number} [number] Number of semester
822+
* @apiQuery {String} [academicYear] To show the current academic year
823+
* @apiQuery {String} [type] Stores the enum ODD or EVEN for semester
824+
* @apiQuery {Date} [startDate] Start date of the semester
825+
* @apiQuery {Date} [endDate] End date of the semester
826+
*
827+
* @apiSuccess {semester[]} res Array of Filtered semester Doc.
828+
* @apiSuccess {Number} semester.number Number of semester
829+
* @apiSuccess {String} semester.academicYear To show the current academic year of the semester
830+
* @apiSuccess {String} semester.type Stores the enum ODD or EVEN for semester
831+
* @apiSuccess {Date} semester.startDate Start date of the semester
832+
* @apiSuccess {Date} semester.endDate End date of the semester
833+
*
834+
*/
835+
836+
/**
837+
* @api {update} /semester/update/:id Request to list Semester information
838+
* @apiName Updatesemester
839+
* @apiGroup Semester
840+
*
841+
* @apiBody {Number} [number] Number of semester
842+
* @apiBody {String} [academicYear] To show the current academic year
843+
* @apiBody {String} [type] Stores the enum ODD or EVEN for semester
844+
* @apiBody {Date} [startDate] Start date of the semester
845+
* @apiBody {Date} [endDate] End date of the semester
846+
*
847+
*@apiSuccess {String} res Semester updated.
848+
* @apiError (Error 500) DatabaseError Error in updating the database.
849+
*
850+
*/
851+
852+
/**
853+
* @api {delete} /semester/delete/:id Request to list Semester information
854+
* @apiName Deletesemester
855+
* @apiGroup Semester
856+
*
857+
* @apiParam {String} id The ID of the Semester document to delete.
858+
*
859+
* @apiSuccess {String} res Success message indicating the deletion.
860+
*
861+
* @apiError (Error 500) DatabaseError Error message if there was an error during the deletion.
862+
*/
863+
864+
865+
// ------------------------------------------------------------------------------------------
866+
// Activity.
867+
// ------------------------------------------------------------------------------------------
868+
869+
/**
870+
* @api {post} /activity/add Add Activty.
871+
* @apiName AddActivity
872+
* @apiGroup Activity
873+
*
874+
* @apiBody {Date} startTime The startTime of the activity.
875+
* @apiBody {Number} duration The duration of the activity (in minutes).
876+
* @apiBody {ObjectId} course The course of the activity (ObjectId).
877+
* @apiBody {ObjectId} faculty The faculty alloted for the activity(ObjectId).
878+
* @apiBody {String} type The type of activity.One of possible LECTURE, PRACTICAL, TUTORIAL.
879+
* @apiBody {ObjectId} task The task of the activity (ObjectId).One of possible Topic,Practical,Tutorial.
880+
* @apiBody {ObjectId} group The group of the activity (ObjectId).
881+
* @apiBody {ObjectId} students the students who gonna attend the activity(ObjectId).
882+
*
883+
* @apiSuccess {String} res Response message.
884+
*
885+
* @apiError (Error 500) DatabaseError Error while inserting in the database.
886+
*
887+
* @apiDescription Adds a new Activity to the system.
888+
*
889+
* @apiSuccessExample Success-Response:
890+
* HTTP/1.1 200 OK
891+
* {
892+
* "res": "Added activity"
893+
* }
894+
*
895+
* @apiErrorExample Error-Response:
896+
* HTTP/1.1 500 Internal Server Error
897+
* {
898+
* "err": "Error while inserting in DB"
899+
* }
900+
*/
901+
902+
/**
903+
* @api {delete} /group/delete/:id Delete Group
904+
* @apiName DeleteGroup
905+
* @apiGroup Group
906+
*
907+
* @apiParam {ObjectId} id The ObjectID of the group to delete.
908+
*
909+
* @apiSuccess {String} res Success message indicating the deletion.
910+
* @apiError (Error 500) GroupDeleteError Error while deleting the group
911+
*
912+
*/
913+
914+
/**
915+
* @api {post} /group/update/:id Update Group Details
916+
* @apiName UpdateGroup
917+
* @apiGroup Group
918+
* @apiDescription Update existing group details.
919+
*
920+
* @apiParam {ObjectId} id The ObjectID of the group to update.
921+
* @apiBody {String} [title] Group title.
922+
* @apiBody {ObjectId[]} [students] Array of student ObjectIDs.
923+
*
924+
* @apiSuccess {String} res Group updated.
925+
* @apiError (Error 500) GroupUpdateError Error in updating database
926+
*
927+
*/
928+
929+
/**
930+
* @api {get} /group/list Get Group List
931+
* @apiName GetGroupList
932+
* @apiGroup Group
933+
*
934+
* @apiQuery {String} [title] Title of the group.
935+
*
936+
* @apiSuccess {Group[]} res Array of filtered group documents.
937+
* @apiSuccess {ObjectId} group._id ObjectID of the group document in the database.
938+
* @apiSuccess {String} group.title Title of the group.
939+
* @apiSuccess {ObjectId[]} group.students Array of student ObjectIDs in the group.
940+
*/
941+
/**
942+
* @api {delete} /timetable/delete/:timetableId Delete Timetable
943+
* @apiName DeleteTimetable
944+
* @apiGroup Timetable
945+
*
946+
* @apiParam {String} timetableId The ID of the timetable document to delete.
947+
*
948+
* @apiSuccess {String} res Success message indicating the deletion.
949+
*
950+
* @apiError (Error 500) DatabaseError Error message if there was an error during the deletion.
951+
*/
952+
953+
/**
954+
* @api {delete} /activity/delete/:activity Delete Activity.
955+
* @apiName DeleteActivity
956+
* @apiGroup Activity
957+
*
958+
* @apiParam {String} Activity The activity document to delete.
959+
*
960+
* @apiSuccess {String} res Success message indicating the deletion.
961+
*
962+
* @apiError (Error 500) DatabaseError Error message if there was an error during the deletion.
963+
*/
964+
965+
/**
966+
* @api {post} /timetable/update Update Timetable
967+
* @apiName UpdateTimetable
968+
* @apiGroup Timetable
969+
* @apiDescription Update existing timetable data.
970+
*
971+
* @apiBody {Date} startTime The startTime of the activity.
972+
* @apiBody {Number} duration The duration of the activity (in minutes).
973+
* @apiBody {ObjectId} course The course of the activity (ObjectId).
974+
* @apiBody {ObjectId} faculty The faculty alloted for the activity(ObjectId).
975+
* @apiBody {String} type The type of activity.One of possible LECTURE, PRACTICAL, TUTORIAL.
976+
* @apiBody {ObjectId} task The task of the activity (ObjectId).One of possible Topic,Practical,Tutorial.
977+
* @apiBody {ObjectId} group The group of the activity (ObjectId).
978+
* @apiBody {ObjectId} students the students who gonna attend the activity(ObjectId).
979+
*
980+
* @apiSuccess {String} res Timetable updated.
981+
*/
982+
983+
/**
984+
* @api {post} /activity/update Update Activity.
985+
* @apiName UpdateActivity
986+
* @apiGroup Activity
987+
* @apiDescription Update existing activity data.
988+
*
989+
* @apiBody {Date} startTime The startTime of the activity.
990+
* @apiBody {Number} duration The duration of the activity (in minutes).
991+
* @apiBody {ObjectId} course The course of the activity (ObjectId).
992+
* @apiBody {ObjectId} faculty The faculty alloted for the activity(ObjectId).
993+
* @apiBody {String} type The type of activity.One of possible LECTURE, PRACTICAL, TUTORIAL.
994+
* @apiBody {ObjectId} task The task of the activity (ObjectId).One of possible Topic,Practical,Tutorial.
995+
* @apiBody {ObjectId} group The group of the activity (ObjectId).
996+
* @apiBody {ObjectId} students the students who gonna attend the activity(ObjectId).
997+
*
998+
* @apiSuccess {String} res Activity updated.
999+
* @apiError (Error 500) DatabaseError Error in updating the database.
1000+
*/
1001+
1002+
/**
1003+
* @api {get} /timetable/list Get Timetable List
1004+
* @apiName GetTimetableList
1005+
* @apiGroup Timetable
1006+
*
1007+
* @apiQuery {Date} startTime The startTime of the activity.
1008+
* @apiQuery {Number} duration The duration of the activity (in minutes).
1009+
* @apiQUERY {ObjectId} course The course of the activity (ObjectId).
1010+
* @apiQuery {ObjectId} faculty The faculty alloted for the activity(ObjectId).
1011+
* @apiQuery {String} type The type of activity.One of possible LECTURE, PRACTICAL, TUTORIAL.
1012+
* @apiQuery {ObjectId} task The task of the activity (ObjectId).One of possible Topic,Practical,Tutorial.
1013+
* @apiQuery {ObjectId} group The group of the activity (ObjectId).
1014+
* @apiQuery {ObjectId} students the students who gonna attend the activity(ObjectId).
1015+
*
1016+
* @apiSuccess {Date} startTime The startTime of the activity.
1017+
* @apiSuccess {Number} duration The duration of the activity (in minutes).
1018+
* @apiSuccess {ObjectId} course The course of the activity (ObjectId).
1019+
* @apiSuccess {ObjectId} faculty The faculty alloted for the activity(ObjectId).
1020+
* @apiSuccess {String} type The type of activity.One of possible LECTURE, PRACTICAL, TUTORIAL.
1021+
* @apiSuccess {ObjectId} task The task of the activity (ObjectId).One of possible Topic,Practical,Tutorial.
1022+
* @apiSuccess {ObjectId} group The group of the activity (ObjectId).
1023+
* @apiSucess {ObjectId} students the students who gonna attend the activity(ObjectId).
1024+
*/
1025+
1026+
/**
1027+
* @api {get} /activity/list Get Activity List
1028+
* @apiName GetActivityList
1029+
* @apiGroup Activity
1030+
*
1031+
* @apiQuery {Date} startTime The startTime of the activity.
1032+
* @apiQuery {Number} duration The duration of the activity (in minutes).
1033+
* @apiQUERY {ObjectId} course The course of the activity (ObjectId).
1034+
* @apiQuery {ObjectId} faculty The faculty alloted for the activity(ObjectId).
1035+
* @apiQuery {String} type The type of activity.One of possible LECTURE, PRACTICAL, TUTORIAL.
1036+
* @apiQuery {ObjectId} task The task of the activity (ObjectId).One of possible Topic,Practical,Tutorial.
1037+
* @apiQuery {ObjectId} group The group of the activity (ObjectId).
1038+
* @apiQuery {ObjectId} students the students who gonna attend the activity(ObjectId).
1039+
*
1040+
* @apiSuccess {Date} startTime The startTime of the activity.
1041+
* @apiSuccess {Number} duration The duration of the activity (in minutes).
1042+
* @apiSuccess {ObjectId} course The course of the activity (ObjectId).
1043+
* @apiSuccess {ObjectId} faculty The faculty alloted for the activity(ObjectId).
1044+
* @apiSuccess {String} type The type of activity.One of possible LECTURE, PRACTICAL, TUTORIAL.
1045+
* @apiSuccess {ObjectId} task The task of the activity (ObjectId).One of possible Topic,Practical,Tutorial.
1046+
* @apiSuccess {ObjectId} group The group of the activity (ObjectId).
1047+
* @apiSucess {ObjectId} students the students who gonna attend the activity(ObjectId).
1048+
*/

app.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { logger } from "#util";
88
import indexRouter from "#routes/index";
99
import usersRouter from "#routes/users";
1010
import authRouter from "#routes/auth";
11+
import semesterRouter from "#routes/semester";
1112
import accreditationRouter from "#routes/accreditation";
1213
import infrastructureRouter from "#routes/infrastructure";
1314
import practicalRouter from "#routes/practical";
@@ -17,9 +18,12 @@ import tutorialRouter from "#routes/tutorial";
1718
import assignmentRouter from "#routes/assignment";
1819
import timetableRouter from "#routes/timetable";
1920
import courseworkRouter from "#routes/coursework";
21+
import activityRouter from "#routes/activity";
2022
import moduleRouter from "#routes/module";
23+
import facultyRouter from "#routes/faculty";
2124
import { identifyUser } from "#middleware/identifyUser";
2225
import departmentRouter from "#routes/department";
26+
import groupRouter from "#routes/group";
2327

2428
const app = express();
2529
const currDirName = dirname(fileURLToPath(import.meta.url));
@@ -46,10 +50,14 @@ app.use("/department", departmentRouter);
4650
app.use("/practical", practicalRouter);
4751
app.use("/organization", organizationRouter);
4852
app.use("/student", studentRouter);
53+
app.use("/activity", activityRouter);
4954
app.use("/tutorial", tutorialRouter);
5055
app.use("/assignment", assignmentRouter);
5156
app.use("/timetable", timetableRouter);
5257
app.use("/department", departmentRouter);
5358
app.use("/coursework", courseworkRouter);
5459
app.use("/module", moduleRouter);
60+
app.use("/group", groupRouter);
61+
app.use("/semester", semesterRouter);
62+
app.use("/faculty", facultyRouter);
5563
export default app;

0 commit comments

Comments
 (0)