-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix conflicts * fix some comments * fix some conflicts * updated and fix comments * remove logs * fix test on question
- Loading branch information
1 parent
f79ce53
commit 3094684
Showing
5 changed files
with
130 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
const router = require('express').Router() | ||
const Question = require('~/models/question') | ||
|
||
const questionController = require('~/controllers/question') | ||
const asyncWrapper = require('~/middlewares/asyncWrapper') | ||
const isEntityValid = require('~/middlewares/entityValidation') | ||
const { authMiddleware, restrictTo } = require('~/middlewares/auth') | ||
|
||
const { | ||
roles: { TUTOR } | ||
} = require('~/consts/auth') | ||
|
||
router.use(authMiddleware) | ||
const params = [{ model: Question, idName: 'id' }] | ||
|
||
router.get('/', asyncWrapper(questionController.getQuestions)) | ||
router.use(restrictTo(TUTOR)) | ||
router.post('/', asyncWrapper(questionController.createQuestion)) | ||
router.patch('/:id', isEntityValid({ params }), asyncWrapper(questionController.updateQuestion)) | ||
|
||
module.exports = router |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters