{"size": 3141, "ext": "js", "max_stars_repo_path": "backend/routes/student.js", "max_stars_repo_name": "eellak/gsoc2019-tms", "max_stars_repo_stars_event_min_datetime": "2019-05-09T13:39:53.000Z", "max_stars_repo_stars_event_max_datetime": "2021-03-09T14:03:00.000Z", "max_issues_repo_path": "backend/routes/student.js", "max_issues_repo_name": "eellak/gsoc2019-tms", "max_issues_repo_issues_event_min_datetime": "2019-06-27T12:55:23.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-17T23:43:51.000Z", "max_forks_repo_path": "backend/routes/student.js", "max_forks_repo_name": "eellak/gsoc2019-tms", "max_forks_repo_forks_event_min_datetime": "2019-05-10T07:35:11.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T13:30:01.000Z"}
{"max_stars_count": 12, "max_issues_count": 9, "max_forks_count": 2, "avg_line_length": 68.2826086957, "max_line_length": 217, "alphanum_fraction": 0.8134352117}

const express = require("express");
const router = express.Router();
const studentController = require('../controllers/student');
const checkAuth = require('../middleware/check-auth');

//URL: /student

router.all("/*",checkAuth,studentController.is_student);   //verify token, check if user is student

router.get("/check/:thesisId",studentController.checkRequest);//check if student has applied in a specific thesis

router.get("/request",studentController.get_request);//get all requests of userId
router.post("/request/:thesisId",studentController.checkUniversity,studentController.check_assigned_thesis,studentController.apply_thesis);    //check if he is logged in-apply for thesis
router.delete("/request/:requestId",studentController.delete_request);    //delete specified request   

router.get("/check_assigned",studentController.check_assigned_thesis,studentController.endrequest); //check if student has assigned to a thesis

router.get("/request/accepted",studentController.get_accepted_request); // get all accepted requests from professors
router.get("/request/:requestId/accepted",studentController.get_accepted_request_byId); // get accepted request by Id
router.post("/request/:requestId/accepted",studentController.post_accepted_request,studentController.delete_all_requests);// confirm request, establish connection(Student,Professor,Thesis) , remove requests of student


router.get("/pending/accepted",studentController.get_accepted_pending) // get all accepted pending thesis of userId (From different professors) returns from pending collection
router.get("/pending/:pendingId/accepted",studentController.get_accepted_pending_byId) //get accepted pending thesis by Id
router.post("/pending/:pendingId/accepted",studentController.confirm_pending,studentController.delete_all_pendings) // thesis is now confirmed for a specific professor

router.get("/pending",studentController.get_pending);  //get pending thesis of userId returns from thesis collection
router.get("/pending/:thesisId",studentController.get_pending_byId); //get pending thesis by id
router.post("/pending",studentController.create_pending); //create pending thesis
router.delete("/pending/:thesisId",studentController.delete_pending) //delete pending thesis

router.get("/thesis",studentController.get_thesis); //get thesis student
router.post("/completed/:assigned_thesisId",studentController.post_completed_file)  // post completed thesis file
router.get("/completed/:assigned_thesisId",studentController.get_completed_file)    //get completed thesis file

router.get("/draft/:assigned_thesisId",studentController.check_thesis,studentController.get_drafts); //get drafts of thesis
router.get("/draft/:assigned_thesisId/:draftId",studentController.check_thesis,studentController.get_draft_byId); //get draft by id of thesis
router.post("/draft/:assigned_thesisId",studentController.check_thesis,studentController.post_draft); //create draft 

router.get("/notification",studentController.get_notifications); //get all notifications

//router.delete("/:userId", checkAuth, thesisController.user_delete); // 
//search thesis
module.exports = router;
