1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Refractor validators

This commit is contained in:
Chocobozzz 2017-11-27 17:30:46 +01:00
parent fcaf1e0aa8
commit a2431b7dcb
No known key found for this signature in database
GPG key ID: 583A612D890159BE
33 changed files with 478 additions and 643 deletions

View file

@ -1,8 +1,7 @@
import { query } from 'express-validator/check'
import * as express from 'express'
import { checkErrors } from './utils'
import { query } from 'express-validator/check'
import { logger } from '../../helpers'
import { areValidationErrors } from './utils'
const paginationValidator = [
query('start').optional().isInt().withMessage('Should have a number start'),
@ -11,7 +10,9 @@ const paginationValidator = [
(req: express.Request, res: express.Response, next: express.NextFunction) => {
logger.debug('Checking pagination parameters', { parameters: req.query })
checkErrors(req, res, next)
if (areValidationErrors(req, res)) return
return next()
}
]