diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-09-15 12:17:08 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-09-15 12:17:08 +0200 |
commit | b60e5f38daf77e720a27aa86d3b482c58906a03a (patch) | |
tree | a70909860ab9705d348b3c082f8af440e0a5e4d2 /server/middlewares/validators/pagination.ts | |
parent | 315cc0cc1871ab2a6d6c1bb61cf7b9f10511c3a9 (diff) | |
download | PeerTube-b60e5f38daf77e720a27aa86d3b482c58906a03a.tar.gz PeerTube-b60e5f38daf77e720a27aa86d3b482c58906a03a.tar.zst PeerTube-b60e5f38daf77e720a27aa86d3b482c58906a03a.zip |
Upgrade express validator to v4
Diffstat (limited to 'server/middlewares/validators/pagination.ts')
-rw-r--r-- | server/middlewares/validators/pagination.ts | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/server/middlewares/validators/pagination.ts b/server/middlewares/validators/pagination.ts index cca8295ff..a5a542cdf 100644 --- a/server/middlewares/validators/pagination.ts +++ b/server/middlewares/validators/pagination.ts | |||
@@ -1,17 +1,19 @@ | |||
1 | import 'express-validator' | 1 | import { query } from 'express-validator/check' |
2 | import * as express from 'express' | 2 | import * as express from 'express' |
3 | 3 | ||
4 | import { checkErrors } from './utils' | 4 | import { checkErrors } from './utils' |
5 | import { logger } from '../../helpers' | 5 | import { logger } from '../../helpers' |
6 | 6 | ||
7 | function paginationValidator (req: express.Request, res: express.Response, next: express.NextFunction) { | 7 | const paginationValidator = [ |
8 | req.checkQuery('start', 'Should have a number start').optional().isInt() | 8 | query('start').optional().isInt().withMessage('Should have a number start'), |
9 | req.checkQuery('count', 'Should have a number count').optional().isInt() | 9 | query('count').optional().isInt().withMessage('Should have a number count'), |
10 | 10 | ||
11 | logger.debug('Checking pagination parameters', { parameters: req.query }) | 11 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
12 | logger.debug('Checking pagination parameters', { parameters: req.query }) | ||
12 | 13 | ||
13 | checkErrors(req, res, next) | 14 | checkErrors(req, res, next) |
14 | } | 15 | } |
16 | ] | ||
15 | 17 | ||
16 | // --------------------------------------------------------------------------- | 18 | // --------------------------------------------------------------------------- |
17 | 19 | ||