aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/videos
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/videos')
-rw-r--r--server/middlewares/validators/videos/videos.ts19
1 files changed, 17 insertions, 2 deletions
diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts
index 96e0d6600..3a7869354 100644
--- a/server/middlewares/validators/videos/videos.ts
+++ b/server/middlewares/validators/videos/videos.ts
@@ -29,7 +29,7 @@ import {
29} from '../../../helpers/custom-validators/videos' 29} from '../../../helpers/custom-validators/videos'
30import { getDurationFromVideoFile } from '../../../helpers/ffmpeg-utils' 30import { getDurationFromVideoFile } from '../../../helpers/ffmpeg-utils'
31import { logger } from '../../../helpers/logger' 31import { logger } from '../../../helpers/logger'
32import { CONSTRAINTS_FIELDS } from '../../../initializers/constants' 32import { CONSTRAINTS_FIELDS, OVERVIEWS } from '../../../initializers/constants'
33import { authenticatePromiseIfNeeded } from '../../oauth' 33import { authenticatePromiseIfNeeded } from '../../oauth'
34import { areValidationErrors } from '../utils' 34import { areValidationErrors } from '../utils'
35import { cleanUpReqFiles } from '../../../helpers/express-utils' 35import { cleanUpReqFiles } from '../../../helpers/express-utils'
@@ -301,6 +301,19 @@ const videosAcceptChangeOwnershipValidator = [
301 } 301 }
302] 302]
303 303
304const videosOverviewValidator = [
305 query('page')
306 .optional()
307 .isInt({ min: 1, max: OVERVIEWS.VIDEOS.SAMPLES_COUNT })
308 .withMessage('Should have a valid pagination'),
309
310 (req: express.Request, res: express.Response, next: express.NextFunction) => {
311 if (areValidationErrors(req, res)) return
312
313 return next()
314 }
315]
316
304function getCommonVideoEditAttributes () { 317function getCommonVideoEditAttributes () {
305 return [ 318 return [
306 body('thumbnailfile') 319 body('thumbnailfile')
@@ -442,7 +455,9 @@ export {
442 455
443 getCommonVideoEditAttributes, 456 getCommonVideoEditAttributes,
444 457
445 commonVideosFiltersValidator 458 commonVideosFiltersValidator,
459
460 videosOverviewValidator
446} 461}
447 462
448// --------------------------------------------------------------------------- 463// ---------------------------------------------------------------------------