Refractor validators
This commit is contained in:
parent
fcaf1e0aa8
commit
a2431b7dcb
33 changed files with 478 additions and 643 deletions
|
@ -1,9 +1,9 @@
|
|||
import { query } from 'express-validator/check'
|
||||
import * as express from 'express'
|
||||
|
||||
import { checkErrors } from './utils'
|
||||
import { logger } from '../../helpers'
|
||||
import { SORTABLE_COLUMNS } from '../../initializers'
|
||||
import { areValidationErrors } from './utils'
|
||||
|
||||
// Initialize constants here for better performances
|
||||
const SORTABLE_USERS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.USERS)
|
||||
|
@ -43,7 +43,9 @@ function checkSort (sortableColumns: string[]) {
|
|||
(req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||
logger.debug('Checking sort 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