X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fvalidators%2Fvideos%2Fvideo-rates.ts;h=0c02baafb9f7c4496bdebcd8e7afa30e0fda612f;hb=396f6f0140b0f76162e2378fd5a61e2f888673ed;hp=8b8eeedb6df9e822c4a8a6010c4978f291f43d7e;hpb=97eba003a9d0adcb0cab9190f566327b1417c7d3;p=github%2FChocobozzz%2FPeerTube.git 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 const videoUpdateRateValidator = [ isValidVideoIdParam('id'), - body('rating').custom(isVideoRatingTypeValid).withMessage('Should have a valid rate type'), + body('rating') + .custom(isVideoRatingTypeValid), async (req: express.Request, res: express.Response, next: express.NextFunction) => { logger.debug('Checking videoRate parameters', { parameters: req.body }) @@ -29,8 +30,10 @@ const videoUpdateRateValidator = [ const getAccountVideoRateValidatorFactory = function (rateType: VideoRateType) { return [ - param('name').custom(isAccountNameValid).withMessage('Should have a valid account name'), - param('videoId').custom(isIdValid).not().isEmpty().withMessage('Should have a valid videoId'), + param('name') + .custom(isAccountNameValid), + param('videoId') + .custom(isIdValid), async (req: express.Request, res: express.Response, next: express.NextFunction) => { logger.debug('Checking videoCommentGetValidator parameters.', { parameters: req.params }) @@ -53,7 +56,9 @@ const getAccountVideoRateValidatorFactory = function (rateType: VideoRateType) { } const videoRatingValidator = [ - query('rating').optional().custom(isRatingValid).withMessage('Value must be one of "like" or "dislike"'), + query('rating') + .optional() + .custom(isRatingValid).withMessage('Value must be one of "like" or "dislike"'), (req: express.Request, res: express.Response, next: express.NextFunction) => { logger.debug('Checking rating parameter', { parameters: req.params })