mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-06 03:50:26 +02:00
Refractor validators
This commit is contained in:
parent
fcaf1e0aa8
commit
a2431b7dcb
33 changed files with 478 additions and 643 deletions
|
@ -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()
|
||||
}
|
||||
]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue