aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/videos/video-rates.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/videos/video-rates.ts')
-rw-r--r--server/middlewares/validators/videos/video-rates.ts13
1 files changed, 9 insertions, 4 deletions
diff --git a/server/middlewares/validators/videos/video-rates.ts b/server/middlewares/validators/videos/video-rates.ts
index 8b8eeedb6..0c02baafb 100644
--- a/server/middlewares/validators/videos/video-rates.ts
+++ b/server/middlewares/validators/videos/video-rates.ts
@@ -13,7 +13,8 @@ import { areValidationErrors, checkCanSeeVideo, doesVideoExist, isValidVideoIdPa
13const videoUpdateRateValidator = [ 13const videoUpdateRateValidator = [
14 isValidVideoIdParam('id'), 14 isValidVideoIdParam('id'),
15 15
16 body('rating').custom(isVideoRatingTypeValid).withMessage('Should have a valid rate type'), 16 body('rating')
17 .custom(isVideoRatingTypeValid),
17 18
18 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 19 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
19 logger.debug('Checking videoRate parameters', { parameters: req.body }) 20 logger.debug('Checking videoRate parameters', { parameters: req.body })
@@ -29,8 +30,10 @@ const videoUpdateRateValidator = [
29 30
30const getAccountVideoRateValidatorFactory = function (rateType: VideoRateType) { 31const getAccountVideoRateValidatorFactory = function (rateType: VideoRateType) {
31 return [ 32 return [
32 param('name').custom(isAccountNameValid).withMessage('Should have a valid account name'), 33 param('name')
33 param('videoId').custom(isIdValid).not().isEmpty().withMessage('Should have a valid videoId'), 34 .custom(isAccountNameValid),
35 param('videoId')
36 .custom(isIdValid),
34 37
35 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 38 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
36 logger.debug('Checking videoCommentGetValidator parameters.', { parameters: req.params }) 39 logger.debug('Checking videoCommentGetValidator parameters.', { parameters: req.params })
@@ -53,7 +56,9 @@ const getAccountVideoRateValidatorFactory = function (rateType: VideoRateType) {
53} 56}
54 57
55const videoRatingValidator = [ 58const videoRatingValidator = [
56 query('rating').optional().custom(isRatingValid).withMessage('Value must be one of "like" or "dislike"'), 59 query('rating')
60 .optional()
61 .custom(isRatingValid).withMessage('Value must be one of "like" or "dislike"'),
57 62
58 (req: express.Request, res: express.Response, next: express.NextFunction) => { 63 (req: express.Request, res: express.Response, next: express.NextFunction) => {
59 logger.debug('Checking rating parameter', { parameters: req.params }) 64 logger.debug('Checking rating parameter', { parameters: req.params })