-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathroutes.js
105 lines (89 loc) · 5.13 KB
/
routes.js
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
var loginController = require('./models/login'),
userdtlsController = require('./models/userdtls'),
edudtlsController = require('./models/edudtls'),
expdtlsController = require('./models/expdtls'),
skillsController = require('./models/skills'),
organisationController = require('./models/organisation'),
connectionController = require('./models/connection'),
jobController = require('./models/jobposts'),
applicationController = require('./models/applyjob'),
postController = require('./models/userposts'),
searchController = require('./models/search');
module.exports = function (app) {
//Auth
app.post('/register', loginController.register);
app.post('/login', loginController.checkLogin);
app.get('/loggedin', loginController.loggedin);
app.post('/logout', loginController.logout);
//HomePost Page
app.get('/userAllPosts/:userid', ensureAuthenticated, postController.userAllPosts);
app.get('/userPostsCount/:userid', ensureAuthenticated, postController.getPostsCount);
app.get('/pagePosts/:userid/:pageNo/:pageSize', ensureAuthenticated, postController.pagePosts);
app.post('/savePost', ensureAuthenticated, postController.savePost);
app.put('/updatePost', ensureAuthenticated, postController.updatePost);
app.delete('/deletePost', ensureAuthenticated, postController.deletePost);
//Search
app.post('/search', ensureAuthenticated, searchController.advanceSearch);
// User Profile
app.put('/userdtls', ensureAuthenticated, userdtlsController.updateUserDtls);
app.get('/userdtls/:userid', ensureAuthenticated, userdtlsController.getUserDtls);
//Education Details
app.post('/edudtls', ensureAuthenticated, edudtlsController.saveEduDtls);
app.put('/edudtls', ensureAuthenticated, edudtlsController.updateEduDtls);
app.delete('/edudtls', ensureAuthenticated, edudtlsController.deleteEduDtls);
app.get('/edudtls/:userid', ensureAuthenticated, edudtlsController.getEduDtls);
//Experience Details
app.post('/expdtls', ensureAuthenticated, expdtlsController.saveExpDtls);
app.put('/expdtls', ensureAuthenticated, expdtlsController.updateExpDtls);
app.delete('/expdtls', ensureAuthenticated, expdtlsController.deleteExpDtls);
app.get('/expdtls/:userid', ensureAuthenticated, expdtlsController.getExpDtls);
//Skills
app.post('/skills', ensureAuthenticated, skillsController.saveSkills);
app.get('/skills', ensureAuthenticated, skillsController.getAllSkills);
app.get('/skills/:userid', ensureAuthenticated, skillsController.getSkills);
//Organisation
app.get('/organisations', ensureAuthenticated, organisationController.getAllOrganisations);
app.get('/institutions', ensureAuthenticated, organisationController.getAllOrganisations);
app.get('/getOrgDtls/:userid', ensureAuthenticated, organisationController.getOrgDtls);
app.put('/saveOrgDtls', ensureAuthenticated, organisationController.saveOrgDtls);
//Connections
app.get('/connect/requestsReceived/:userid', ensureAuthenticated, connectionController.getAllReqReceived);
app.get('/connect/requestsSent/:userid', ensureAuthenticated, connectionController.getAllReqSent);
app.get('/connect/approved/:userid', ensureAuthenticated, connectionController.getAllConn);
app.post('/connect', ensureAuthenticated, connectionController.addConn);
app.post('/connect/accept', ensureAuthenticated, connectionController.acceptConn);
app.delete('/connect', ensureAuthenticated, connectionController.removeConn);
app.get('/connect/:userid/:secuserid', ensureAuthenticated, connectionController.checkUsersConn);
app.get('/notconnected/:userid', ensureAuthenticated, connectionController.getRecoConn);
//Jobs
app.post('/postjob', ensureAuthenticated, jobController.postJob);
app.put('/updatejob', ensureAuthenticated, jobController.updateJob);
app.get('/getjob', ensureAuthenticated, jobController.getAllJobs);
app.get('/getorgjob/:userid', ensureAuthenticated, jobController.getAllJobsByOrg);
app.get('/getjob/:jobid', ensureAuthenticated, jobController.getJobById);
app.delete('/deletejob', ensureAuthenticated, jobController.deleteJob);
//Job Application
app.post('/postapp', ensureAuthenticated, applicationController.postApplication);
app.get('/getuserapp/:userid', ensureAuthenticated, applicationController.getUserApplications);
app.get('/getorgjobapp/:jobid', ensureAuthenticated, applicationController.getOrgApplications);
app.get('/getrecojobs/:userid', ensureAuthenticated, applicationController.getRecommendedJobs);
//app state routing
app.get('/home', ensureAuthenticated, function (req, res) {
res.redirect('/login');
});
app.get('/organisation', ensureAuthenticated, function (req, res) {
res.redirect('/login');
});
//Auth Middleware
function ensureAuthenticated(req, res, next) {
if (req.isAuthenticated()) {
return next();
} else {
res.redirect('/login');
//res.status(401).json({message : "Unauthorized access !!"});
}
}
// rest api deleted
// linked in authentication deleted
// email smtp deleted
};