Skip to content

Commit 4803c10

Browse files
Merge branch 'development' into 220-adding-CURD-to-coursework
2 parents 46241a6 + a3005b3 commit 4803c10

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2237
-412
lines changed

_apidoc.js

Lines changed: 354 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,3 +309,357 @@
309309
* @apiSuccess {Date} accreditation.dateofAccreditation Date on which accreditation was issued.
310310
* @apiSuccess {Date} accreditation.dateofExpiry Date till which accreditation is valid.
311311
*/
312+
//------------------------------------------------------------------------------------------
313+
// Tutorials.
314+
// ------------------------------------------------------------------------------------------
315+
316+
/**
317+
* @api {post} /tutorial/add Add Tutorial
318+
* @apiName AddTutorial
319+
* @apiGroup Tutorial
320+
*
321+
* @apiBody {Number} no The number of tutorial.
322+
* @apiBody {String} title The title of tutorial.
323+
* @apiBody {Number} hours The hours required for tutorial .
324+
* @apiBody {String} cognitiveLevel The cognitiveLvel of tutorial.
325+
326+
*
327+
* @apiSuccess {String} res Success message with the ID of the added tutorial.
328+
*
329+
* @apiError (Error 500) DatabaseError Error while inserting in the database.
330+
*
331+
* @apiDescription Adds a new tutorial to the system.
332+
*/
333+
334+
/**
335+
* @api {get} tutorial/list Get Tutorial List
336+
* @apiName GetTutorial
337+
* @apiGroup Tutorial
338+
*
339+
* @apiQuery {Number} [no] Number of Tutorial.
340+
* @apiQuery {String} [title] Title of Tutorial.
341+
* @apiQuery {Number} [hours] Hours required for Tutorial
342+
* @apiQuery {String} [cognitiveLevel] Level of Tutorial.
343+
344+
*
345+
* @apiSuccess {Tutorial[]} res Array of Filtered Tutorial Doc .
346+
* @apiSuccess {String} tutorial._id ID of document given by database.
347+
* @apiSuccess {Number} tutorial.no Number of Tutorial.
348+
* @apiSuccess {String} tutorial.title Title of Tutorial.
349+
* @apiSuccess {String} tutorial.hours Hours of Tutorial.
350+
* @apiSuccess {Number} tutorial.cognitiveLevel CognitiveLevel of Tutorial.
351+
*/
352+
353+
/**
354+
* @api {delete} /tutorial/delete/:tutorialId Delete Tutorial
355+
* @apiName DeleteTutorial,
356+
* @apiGroup Tutorial
357+
*
358+
* @apiParam {String} tutorialId The ID of the tutorial document to delete.
359+
*
360+
* @apiSuccess {String} res Success message indicating the deletion.
361+
*
362+
* @apiError (Error 500) err Error message if there was an error during the deletion.
363+
*
364+
* */
365+
/**
366+
* @api {post} /tutorial/update Update tutorial details
367+
* @apiName UpdateTutorial
368+
* @apiGroup Tutorial
369+
* @apiDescription update Existing Tutorial details
370+
*
371+
* @apiBody {String} id Id of the tutorial to be updated
372+
* @apiBody {Number} [no] The no of tutorial.
373+
* @apiBody {String} [title] The title of tutorial.
374+
* @apiBody {String} [hours] The hours required for the tutorial.
375+
* @apiBody {Number} [cognitiveLevel] The cognitiveLevel of tutorial.
376+
377+
*
378+
* @apiSuccess {String} res tutorial updated.
379+
* @apiError (Error 500) err Error in updating database
380+
*
381+
*/
382+
383+
// ------------------------------------------------------------------------------------------
384+
// Timetable.
385+
// ------------------------------------------------------------------------------------------
386+
387+
/**
388+
* @api {post} /timetable/add Add Timetable
389+
* @apiName AddTimetable
390+
* @apiGroup Timetable
391+
* @apiDescription Add a new timetable entry.
392+
*
393+
* @apiBody {Date} startDate Start date of the timetable.
394+
* @apiBody {Date} endDate End date of the timetable.
395+
* @apiBody {ObjectId} classIncharge ID of the faculty in charge (ObjectId).
396+
* @apiBody {ObjectId} group ID of the group (ObjectId).
397+
* @apiBody {ObjectId} activityBlueprints ID of the activity blueprint (ObjectId).
398+
* @apiBody {String} lunchBreakStartTime Start time of the lunch break.
399+
* @apiBody {Number} lunchBreakDuration Duration of the lunch break (in minutes).
400+
* @apiBody {String} teaBreakStartTime Start time of the tea break.
401+
* @apiBody {Number} teaBreakDuration Duration of the tea break (in minutes).
402+
*
403+
* @apiSuccess {String} res Response message.
404+
* @apiError (Error 500) DatabaseError Error message if there was an error inserting into the database.
405+
*
406+
* @apiSuccessExample Success-Response:
407+
* HTTP/1.1 200 OK
408+
* {
409+
* "res": "Added timetable for <startDate> - <endDate>"
410+
* }
411+
*
412+
* @apiErrorExample Error-Response:
413+
* HTTP/1.1 500 Internal Server Error
414+
* {
415+
* "err": "Error while inserting in DB"
416+
* }
417+
*/
418+
419+
// ------------------------------------------------------------------------------------------
420+
// Department.
421+
// ------------------------------------------------------------------------------------------
422+
423+
/**
424+
* @api {post} /department/create Create Deapartment
425+
* @apiName AddDepartment
426+
* @apiDescription Adds a new Department.
427+
* @apiGroup Department
428+
*
429+
* @apiBody {String} name The name of the Department.
430+
* @apiBody {String} acronym The acronym of the Department.
431+
* @apiBody {Date} yearOfStarting The year of establishment of the Department.
432+
* @apiBody {connector.Schema.Types.ObjectId} accreditations The accreditation which is associated.
433+
* @apiBody {connector.Schema.Types.ObjectId} infrastructure The infrastructure which is associated.
434+
*
435+
* @apiSuccess {String} res added Department successfully.
436+
*
437+
* @apiError (Error 500) DatabaseError Error while inserting in the DB.
438+
*
439+
*/
440+
441+
/**
442+
* @api {get} Department/list Listdown Department
443+
* @apiName GetDepartment
444+
* @apiDescription Listdown the Department.
445+
* @apiGroup Department
446+
*
447+
* @apiBody {String} [name] The name of the Department.
448+
* @apiBody {String} [acronym] The acronym of the Department.
449+
* @apiBody {Date} [yearOfStarting] The year of establishment of the Department.
450+
* @apiBody {connector.Schema.Types.ObjectId} [accreditations] Accreditation which is associated.
451+
* @apiBody {connector.Schema.Types.ObjectId} [infrastructure] Infrastructure which is associated.
452+
*
453+
* @apiSuccess {Department[]} res Array of Filtered Department Doc .
454+
* @apiSuccess {String} department._id ID of document given by database.
455+
* @apiSuccess {String} department.name Name of Infrastructure
456+
* @apiSuccess {String} department.acronym The acronym of the Department.
457+
* @apiSuccess {Date} department.yearOfStarting The year of establishment of the Department.
458+
* @apiSuccess {connector.Schema.Types.ObjectId} department.accreditations associated Accreditation.
459+
* @apiSuccess {connector.Schema.Types.ObjectId} department.infrastructure associatedInfrastructure.
460+
* @apiError (Error 500) err Error while fetching the data.
461+
*/
462+
463+
/**
464+
* @api {delete} /department/delete/:departmentId Delete Department
465+
* @apiName DeleteDepartment
466+
* @apiDescription Remove the existing Department.
467+
* @apiGroup Department
468+
*
469+
* @apiParam {String} departmentId The ID of the department document to delete.
470+
*
471+
* @apiSuccess {String} res "Department deleted successfully.
472+
*
473+
* @apiError (Error 500) err Error while deleting from DB.
474+
*
475+
* */
476+
477+
/**
478+
* @api {post} /department/update Update department
479+
* @apiName UpdateDepartment
480+
* @apiGroup Department
481+
* @apiDescription Update Existing Department details except [yearOfStarting],[acronym]
482+
*
483+
* @apiSuccess {String} department._id ID of document given by database.
484+
* @apiSuccess {String} department.name Name of Infrastructure
485+
* @apiSuccess {String} department.acronym The acronym of the Department.
486+
* @apiSuccess {Date} department.yearOfStarting The year of establishment of the Department.
487+
* @apiSuccess {connector.Schema.Types.ObjectId} department.accreditations associated Accreditation.
488+
* @apiSuccess {connector.Schema.Types.ObjectId} department.infrastructure associatedInfrastructure.
489+
*
490+
* @apiSuccess {String} res updated infrastructure with id.
491+
* @apiError (Error 500) err Error while inserting in DB
492+
*/
493+
494+
//
495+
// Coursework.
496+
// ------------------------------------------------------------------------------------------
497+
498+
/**
499+
* @api {post} /coursework/add Add Coursework
500+
* @apiName AddCoursework
501+
* @apiGroup Coursework
502+
* @apiDescription Add a new coursework entry.
503+
*
504+
* @apiBody {ObjectId} student ID of the student (ObjectId).
505+
* @apiBody {String} Coursework type that is either onCampus or offCampus.
506+
* @apiBody {ObjectId} course ID of the Course in Coursework (ObjectId).
507+
* @apiBody {ObjectId} task ID of the task in Coursework (ObjectId).
508+
* @apiBody {String} objectID either its practicals or tutorial or assignment .
509+
* @apiBody {ObjectId} activity Id of the activity in Coursework.
510+
* @apiBody {Number} Marks in the Coursework.
511+
*
512+
* @apiSuccess {String} res Response message.
513+
* @apiError (Error 500) DatabaseError Err message if there is an error inserting into the database.
514+
*
515+
* @apiSuccessExample Success-Response:
516+
* HTTP/1.1 200 OK
517+
* {
518+
* "res": "Added coursework"
519+
* }
520+
*
521+
* @apiErrorExample Error-Response:
522+
* HTTP/1.1 500 Internal Server Error
523+
* {
524+
* "err": "Error while inserting in DB"
525+
* }
526+
*/
527+
528+
/**
529+
* @api {delete} /timetable/delete/:timetableId Delete Timetable
530+
* @apiName DeleteTimetable
531+
* @apiGroup Timetable
532+
*
533+
* @apiParam {String} timetableId The ID of the timetable document to delete.
534+
*
535+
* @apiSuccess {String} res Success message indicating the deletion.
536+
*
537+
* @apiError (Error 500) DatabaseError Error message if there was an error during the deletion.
538+
*/
539+
540+
/**
541+
* @api {delete} /coursework/delete/:courseworkId Delete Coursework
542+
* @apiName DeleteCoursework
543+
* @apiGroup Coursework
544+
*
545+
* @apiParam {String} courseworkId The ID of the Coursework document to delete.
546+
*
547+
* @apiSuccess {String} res Success message indicating the deletion.
548+
*
549+
* @apiError (Error 500) DatabaseError Error message if there was an error during the deletion.
550+
*/
551+
552+
/**
553+
* @api {post} /timetable/update Update Timetable
554+
* @apiName UpdateTimetable
555+
* @apiGroup Timetable
556+
* @apiDescription Update existing timetable data.
557+
*
558+
* @apiBody {String} id ID of the timetable to be updated.
559+
* @apiBody {Date} [startDate] Start date of the timetable.
560+
* @apiBody {Date} [endDate] End date of the timetable.
561+
* @apiBody {ObjectId} [classIncharge] ID of the faculty in charge (ObjectId).
562+
* @apiBody {ObjectId} [group] ID of the group (ObjectId).
563+
* @apiBody {ObjectId} [activityBlueprints] ID of activity blueprint (ObjectId).
564+
* @apiBody {String} [lunchBreakStartTime] Start time of the lunch break.
565+
* @apiBody {Number} [lunchBreakDuration] Duration of lunch break (in minutes).
566+
* @apiBody {String} [teaBreakStartTime] Start time of tea break.
567+
* @apiBody {Number} [teaBreakDuration] Duration of tea break (in minutes).
568+
*
569+
* @apiSuccess {String} res Timetable updated.
570+
571+
/**
572+
* @api {post} /coursework/update Update Coursework
573+
* @apiName UpdateCoursework
574+
* @apiGroup Coursework
575+
* @apiDescription Update existing coursework data.
576+
*
577+
* @apiBody {String} id ID of the Coursework to be updated.
578+
* @apiBody {ObjectId} student ID of the student (ObjectId).
579+
* @apiBody {String} Coursework type that is either onCampus or offCampus.
580+
* @apiBody {ObjectId} course ID of the Course in Coursework (ObjectId).
581+
* @apiBody {ObjectId} task ID of the task in Coursework (ObjectId).
582+
* @apiBody {String} objectID either its practicals or tutorial or assignment .
583+
* @apiBody {ObjectId} activity Id of the activity in Coursework.
584+
* @apiBody {Number} Marks in the Coursework.
585+
*
586+
* @apiSuccess {String} res Coursework updated.
587+
* @apiError (Error 500) DatabaseError Error in updating the database.
588+
*/
589+
590+
/**
591+
* @api {get} /timetable/list Get Timetable List
592+
* @apiName GetTimetableList
593+
* @apiGroup Timetable
594+
*
595+
* @apiQuery {Date} [startDate] Start date of the timetable.
596+
* @apiQuery {Date} [endDate] End date of the timetable.
597+
* @apiQuery {ObjectId} [classIncharge] ID of the faculty in charge (ObjectId).
598+
* @apiQuery {ObjectId} [group] ID of the group (ObjectId).
599+
* @apiQuery {ObjectId} [activityBlueprints] ID of the activity blueprint (ObjectId).
600+
* @apiQuery {String} [lunchBreakStartTime] Start time of the lunch break.
601+
* @apiQuery {Number} [lunchBreakDuration] Duration of the lunch break (in minutes).
602+
* @apiQuery {String} [lunchBreakStartTime] Start time of the lunch break.
603+
* @apiQuery {Number} [lunchBreakDuration] Duration of the lunch break (in minutes).
604+
*
605+
* @apiSuccess {Timetable[]} res Array of filtered timetable documents.
606+
* @apiSuccess {String} timetable._id ID of the timetable document given by the database.
607+
* @apiSuccess {Date} timetable.startDate Start date of the timetable.
608+
* @apiSuccess {Date} timetable.endDate End date of the timetable.
609+
* @apiSuccess {ObjectId} timetable.classIncharge ID of the faculty in charge (ObjectId).
610+
* @apiSuccess {ObjectId} timetable.group ID of the group (ObjectId).
611+
* @apiSuccess {ObjectId} timetable.activityBlueprints ID of the activity blueprint (ObjectId).
612+
* @apiSuccess {String} timetable.lunchBreakStartTime Start time of the lunch break.
613+
* @apiSuccess {Number} timetable.lunchBreakDuration Duration of the lunch break (in minutes).
614+
* @apiSuccess {String} timetable.teaBreakStartTime Start time of the tea break.
615+
* @apiSuccess {Number} timetable.teaBreakDuration Duration of the tea break (in minutes).
616+
617+
/**
618+
* @api {get} /coursework/list Get Coursework List
619+
* @apiName GetCourseworkList
620+
* @apiGroup Coursework
621+
*
622+
* @apiQuery {ObjectId} student ID of the student (ObjectId).
623+
* @apiQuery {String} Coursework type that is either onCampus or offCampus.
624+
* @apiQuery {ObjectId} course ID of the Course in Coursework (ObjectId).
625+
* @apiQuery {ObjectId} task ID of the task in Coursework (ObjectId).
626+
* @apiQuery {String} objectID either its practicals or tutorial or assignment .
627+
* @apiQuery {ObjectId} activity Id of the activity in Coursework.
628+
* @apiQuery {Number} Marks in the Coursework.
629+
*
630+
* @apiSuccess {Coursework[]} res Array of filtered coursework documents.
631+
* @apiSuccess {String} coursework._id ID of the coursework document given by the database.
632+
* @apiSuccess {ObjectId} coursework.student ID of the student (ObjectId).
633+
* @apiSuccess {String} coursework.type Coursework type that is either onCampus or offCampus.
634+
* @apiSuccess {ObjectId} coursework.course ID of the Course in Coursework (ObjectId).
635+
* @apiSuccess {ObjectId} coursework.task ID of the task in Coursework (ObjectId).
636+
* @apiSuccess {String} coursework.objectID objectID either Practicals or Tutorial or Assignment .
637+
* @apiSuccess {ObjectId} coursework.activity Id of the activity in Coursework.
638+
* @apiSuccess {Number} coursework.marks Marks in the Coursework.
639+
*/
640+
641+
// ------------------------------------------------------------------------------------------
642+
// Module.
643+
// ------------------------------------------------------------------------------------------
644+
645+
/**
646+
* @api {get} module/list Get Module List
647+
* @apiName GetModule
648+
* @apiGroup Module
649+
*
650+
* @apiQuery {Number} [no] Module number.
651+
* @apiQuery {String} [name] Name of the module.
652+
* @apiQuery {String} [outcome] Module outcome.
653+
* @apiQuery {String[]} [contents] Array of contents of the module.
654+
* @apiQuery {Number} [hrsPerModule] Number of hours required per module.
655+
* @apiQuery {String[]} [cognitiveLevels] Array of cognitive levels of attainment as per Bloom's Taxanomy (L1-L6).
656+
*
657+
* @apiSuccess {module[]} res Array of Filtered module Doc.
658+
* @apiSuccess {String} module._id ID of document given by database.
659+
* @apiSuccess {String} module.no Module number.
660+
* @apiSuccess {String} module.name Name of the module.
661+
* @apiSuccess {String} module.outcome Module outcome.
662+
* @apiSuccess {String[]} module.contents Array of contents of the module.
663+
* @apiSuccess {Number} module.hrsPerModule Number of hours required per module.
664+
* @apiSuccess {String[]} module.cognitiveLevels Array of cognitive levels of attainment as per Bloom's Taxanomy (L1-L6).
665+
*/

app.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ import usersRouter from "#routes/users";
1010
import authRouter from "#routes/auth";
1111
import accreditationRouter from "#routes/accreditation";
1212
import infrastructureRouter from "#routes/infrastructure";
13+
import organizationRouter from "#routes/organization";
14+
import studentRouter from "#routes/student";
15+
import tutorialRouter from "#routes/tutorial";
16+
import assignmentRouter from "#routes/assignment";
17+
import timetableRouter from "#routes/timetable";
18+
import courseworkRouter from "#routes/coursework";
19+
import moduleRouter from "#routes/module";
1320
import { identifyUser } from "#middleware/identifyUser";
21+
import departmentRouter from "#routes/department";
1422

1523
const app = express();
1624
const currDirName = dirname(fileURLToPath(import.meta.url));
@@ -33,5 +41,13 @@ app.use("/users", usersRouter);
3341
app.use("/auth", authRouter);
3442
app.use("/accreditation", accreditationRouter);
3543
app.use("/infrastructure", infrastructureRouter);
44+
app.use("/organization", organizationRouter);
45+
app.use("/student", studentRouter);
46+
app.use("/tutorial", tutorialRouter);
47+
app.use("/assignment", assignmentRouter);
48+
app.use("/timetable", timetableRouter);
49+
app.use("/department", departmentRouter);
50+
app.use("/coursework", courseworkRouter);
51+
app.use("/module", moduleRouter);
3652

3753
export default app;

0 commit comments

Comments
 (0)