aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-02-26 16:26:27 +0100
committerChocobozzz <me@florianbigard.com>2021-03-03 10:08:08 +0100
commit74d249bc1346c7cfaac7ee49bebbebcf2a01f82a (patch)
treed47bd163ae57ed8f15b445296634cc04f4f67b6f /server/middlewares/validators
parent095e2258043fcff8a79ab082d11edfbd8f13a8e2 (diff)
downloadPeerTube-74d249bc1346c7cfaac7ee49bebbebcf2a01f82a.tar.gz
PeerTube-74d249bc1346c7cfaac7ee49bebbebcf2a01f82a.tar.zst
PeerTube-74d249bc1346c7cfaac7ee49bebbebcf2a01f82a.zip
Add ability to cleanup remote AP interactions
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r--server/middlewares/validators/videos/video-rates.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/server/middlewares/validators/videos/video-rates.ts b/server/middlewares/validators/videos/video-rates.ts
index 7dcba15f1..01bdef25f 100644
--- a/server/middlewares/validators/videos/video-rates.ts
+++ b/server/middlewares/validators/videos/video-rates.ts
@@ -1,6 +1,6 @@
1import * as express from 'express' 1import * as express from 'express'
2import { body, param, query } from 'express-validator' 2import { body, param, query } from 'express-validator'
3import { isIdOrUUIDValid } from '../../../helpers/custom-validators/misc' 3import { isIdOrUUIDValid, isIdValid } from '../../../helpers/custom-validators/misc'
4import { isRatingValid } from '../../../helpers/custom-validators/video-rates' 4import { isRatingValid } from '../../../helpers/custom-validators/video-rates'
5import { isVideoRatingTypeValid } from '../../../helpers/custom-validators/videos' 5import { isVideoRatingTypeValid } from '../../../helpers/custom-validators/videos'
6import { logger } from '../../../helpers/logger' 6import { logger } from '../../../helpers/logger'
@@ -28,14 +28,14 @@ const videoUpdateRateValidator = [
28const getAccountVideoRateValidatorFactory = function (rateType: VideoRateType) { 28const getAccountVideoRateValidatorFactory = function (rateType: VideoRateType) {
29 return [ 29 return [
30 param('name').custom(isAccountNameValid).withMessage('Should have a valid account name'), 30 param('name').custom(isAccountNameValid).withMessage('Should have a valid account name'),
31 param('videoId').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid videoId'), 31 param('videoId').custom(isIdValid).not().isEmpty().withMessage('Should have a valid videoId'),
32 32
33 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 33 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
34 logger.debug('Checking videoCommentGetValidator parameters.', { parameters: req.params }) 34 logger.debug('Checking videoCommentGetValidator parameters.', { parameters: req.params })
35 35
36 if (areValidationErrors(req, res)) return 36 if (areValidationErrors(req, res)) return
37 37
38 const rate = await AccountVideoRateModel.loadLocalAndPopulateVideo(rateType, req.params.name, req.params.videoId) 38 const rate = await AccountVideoRateModel.loadLocalAndPopulateVideo(rateType, req.params.name, +req.params.videoId)
39 if (!rate) { 39 if (!rate) {
40 return res.status(HttpStatusCode.NOT_FOUND_404) 40 return res.status(HttpStatusCode.NOT_FOUND_404)
41 .json({ error: 'Video rate not found' }) 41 .json({ error: 'Video rate not found' })