-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.js
104 lines (82 loc) · 4.67 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
const passport = require('passport'); // มันสำคัญที่สุดนะ เลยต้องอยู่ข้างบน/
const passportService = require('./service/passport');
const requireSignin = passport.authenticate('local', { session: false });
const requireAuth = passport.authenticate('jwt', { session: false });
const registers = require('./controllers/registers');
const users = require('./controllers/Users');
const courses = require('./controllers/Courses');
const period = require('./controllers/Period');
const courseOrder = require('./controllers/CourseOrders');
const Examination = require('./controllers/Examination');
const operationRoom = require('./controllers/OperationRoom');
const attendee = require('./controllers/Attender');
const survey = require('./controllers/Survey');
const certification = require('./controllers/certification');
const analysis = require('./controllers/analysis');
const userTypes = require('./controllers/userTypes');
module.exports = function(app) {
app.get('/', function(req, res){
res.send({message: 'lpru conference api'})
req.getConnection((err, connection)=>{
connection.query('USE mysql', function(err) {
//if (err) throw err;
console.log(err);
res.send('Query Successful');
});
})
})
app.post('/signin',requireSignin, users.signin)
app.get('/updateToken',requireAuth, users.signin);
app.get('/users',requireAuth, users.findAll)
app.get(`/userTypes`, requireAuth, userTypes.findAll);
app.post(`/userTypes`, requireAuth, userTypes.create);
app.put(`/userTypes/:id`, requireAuth, userTypes.update)
app.delete('/userTypes/:id', requireAuth, userTypes.delete);
app.post('/registers', registers.create)
app.post('/users', requireAuth, users.create)
app.get('/users/:id', requireAuth, users.findById)
app.put('/users/:id', requireAuth, users.update)
app.delete('/users/:id', requireAuth, users.delete)
app.get('/course', courses.findAll);
app.get('/course/:id', courses.findById);
app.post('/course', requireAuth, courses.create);
app.put('/course/:id', requireAuth, courses.update);
app.delete('/course/:id', requireAuth, courses.delete);
app.get('/period/', period.findAll);
app.get('/period/:id', period.findById);
app.post('/period/', requireAuth, period.create);
app.put('/period/:id', requireAuth, period.update);
app.delete('/period/:id', requireAuth, period.delete);
app.get('/courseorder/', courseOrder.findAll);
app.get('/orders',requireAuth, courseOrder.findAllByCompletePeriod);
app.get('/courseorder/:id', courseOrder.findById)
app.post('/courseorder/', courseOrder.create);
app.get('/courseorder/user/:id', requireAuth, courseOrder.findByuserId)
app.put('/courseorder/:id',courseOrder.update);
app.delete('/courseorder/:id', courseOrder.delete);
app.get('/examination/:course_id/:exam_id', Examination.findById);
app.post('/registerexamination/', requireAuth, Examination.registers);
app.get('/examinationbycourse/', requireAuth, courses.findAllByExams);
app.get('/nullexamination/', Examination.findNullexam);
app.get('/examination/:id', requireAuth, Examination.findExambycourse);
app.post('/registerexamination/update/:id', requireAuth, Examination.update);
app.get('/examination/:course_id', requireAuth, Examination.findExambycourse)
app.post('/examination/save', requireAuth, Examination.userExaminationCreate )
app.get('/examination/check/:per_id/:sub', requireAuth , Examination.userChecker);
app.get('/operation_room/', requireAuth, operationRoom.findAll);
app.get('/operation_room/:id',requireAuth, operationRoom.findById);
app.post('/operation_room/', requireAuth, operationRoom.create);
app.put('/operation_room/:id', requireAuth, operationRoom.update);
app.delete('/operation_room/:id', requireAuth, operationRoom.delete);
app.get('/attendee/:id', attendee.findById);
app.post('/attendee/:id', requireAuth, attendee.create);
app.delete('/attendee/:id', requireAuth, attendee.delete);
app.get('/publicusers/', users.findByTerm);
app.get('/publicuser/:id', requireAuth, users.findPublicId);
app.post('/survey', requireAuth, survey.create );
app.get('/certification', requireAuth, certification.findAll);
app.get('/certification/forprint', requireAuth, certification.findByOption);
app.get('/certification/period/:id', requireAuth, certification.findByPeriodsId)
app.get('/analysis/attends/:year', requireAuth, analysis.attendYears);
app.get(`/periodsurvey/:periodId`, requireAuth, analysis.periodsurvey)
}