]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/activitypub/pagination.ts
Merge branch 'release/3.3.0' into develop
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / activitypub / pagination.ts
index 8b32d3415cc3f31a7ddde0351bea4086129567e6..c8ec34eb6addcfa0c0b829c3a414692c06aef1cb 100644 (file)
@@ -1,11 +1,16 @@
 import * as express from 'express'
 import { query } from 'express-validator'
+import { PAGINATION } from '@server/initializers/constants'
 import { logger } from '../../../helpers/logger'
-import { areValidationErrors } from '../utils'
+import { areValidationErrors } from '../shared'
 
 const apPaginationValidator = [
-  query('page').optional().isInt({ min: 1 }).withMessage('Should have a valid page number'),
-  query('size').optional().isInt({ max: 50 }).withMessage('Should have a valid page size (max: 50)'),
+  query('page')
+    .optional()
+    .isInt({ min: 1 }).withMessage('Should have a valid page number'),
+  query('size')
+    .optional()
+    .isInt({ min: 0, max: PAGINATION.OUTBOX.COUNT.MAX }).withMessage(`Should have a valid page size (max: ${PAGINATION.OUTBOX.COUNT.MAX})`),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
     logger.debug('Checking pagination parameters', { parameters: req.query })