Add pod list endpoint with pagination, sort...
This commit is contained in:
parent
9fd540562c
commit
8a02bd0433
19 changed files with 232 additions and 94 deletions
|
@ -3,12 +3,12 @@ import * as express from 'express'
|
|||
|
||||
import { logger } from '../../helpers'
|
||||
|
||||
function checkErrors (req: express.Request, res: express.Response, next: express.NextFunction, statusCode = 400) {
|
||||
function checkErrors (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const errors = validationResult(req)
|
||||
|
||||
if (!errors.isEmpty()) {
|
||||
logger.warn('Incorrect request parameters', { path: req.originalUrl, err: errors.mapped() })
|
||||
return res.status(statusCode).json({ errors: errors.mapped() })
|
||||
return res.status(400).json({ errors: errors.mapped() })
|
||||
}
|
||||
|
||||
return next()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue