X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fvalidators%2Fpagination.ts;h=79ddbbf184d42c0c36be7c538a36f7ae3dc7f44a;hb=8ca52bcc2c37d457e8b19a237c66b8dd1c00b6b9;hp=74eae251e04790dbbd53a60b02e7446106995f12;hpb=cf21b2cbef61929177b9c09b5e017c3b7eb8535d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/validators/pagination.ts b/server/middlewares/validators/pagination.ts index 74eae251e..79ddbbf18 100644 --- a/server/middlewares/validators/pagination.ts +++ b/server/middlewares/validators/pagination.ts @@ -1,7 +1,6 @@ -import * as express from 'express' +import express from 'express' import { query } from 'express-validator' import { PAGINATION } from '@server/initializers/constants' -import { logger } from '../../helpers/logger' import { areValidationErrors } from './shared' const paginationValidator = paginationValidatorBuilder() @@ -10,15 +9,13 @@ function paginationValidatorBuilder (tags: string[] = []) { return [ query('start') .optional() - .isInt({ min: 0 }).withMessage('Should have a number start'), + .isInt({ min: 0 }), query('count') .optional() .isInt({ min: 0, max: PAGINATION.GLOBAL.COUNT.MAX }).withMessage(`Should have a number count (max: ${PAGINATION.GLOBAL.COUNT.MAX})`), (req: express.Request, res: express.Response, next: express.NextFunction) => { - logger.debug('Checking pagination parameters', { parameters: req.query, tags }) - - if (areValidationErrors(req, res)) return + if (areValidationErrors(req, res, { tags })) return return next() }