-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser.router.js
40 lines (37 loc) · 1.4 KB
/
user.router.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
const express = require('express');
const router = express.Router();
const asyncWrap = require('../middlewares/asyncWrap');
const auth = require('../middlewares/auth');
const {
signup,
signin,
getInfoUser,
logout,
getPublicTest,
getPrivateTestOfUser,
getAudioByUser,
setPointForAudio,
updateRealUserForAudio,
getIndexAudio,
changePassword,
setMaxIndexAudio,
getTestById,
increaseListensAudio,
getListensAudio,
} = require('../controllers/user.controller');
router.post('/signup', asyncWrap(signup));
router.post('/signin', asyncWrap(signin));
router.post('/logout', auth, asyncWrap(logout));
router.get('/', auth, asyncWrap(getInfoUser));
router.get('/public-tests', auth, asyncWrap(getPublicTest));
router.get('/private-tests/:user', auth, asyncWrap(getPrivateTestOfUser));
router.get('/get-audio', auth, asyncWrap(getAudioByUser));
router.put('/set-point', auth, asyncWrap(setPointForAudio));
router.put('/update-real-user', auth, asyncWrap(updateRealUserForAudio));
router.get('/get-index-audio', auth, asyncWrap(getIndexAudio));
router.put('/change-password', auth, asyncWrap(changePassword));
router.put('/set-max-index-audio', auth, asyncWrap(setMaxIndexAudio));
router.get('/tests/:id', auth, asyncWrap(getTestById));
router.post('/increase-listens-audio', auth, asyncWrap(increaseListensAudio));
router.get('/get-listens-audio', auth, asyncWrap(getListensAudio));
module.exports = router;