1 import 'express-validator'
2 import * as express from 'express'
4 import { PAGINATION } from '../initializers'
6 function setDefaultPagination (req: express.Request, res: express.Response, next: express.NextFunction) {
7 if (!req.query.start) req.query.start = 0
8 else req.query.start = parseInt(req.query.start, 10)
10 if (!req.query.count) req.query.count = PAGINATION.COUNT.DEFAULT
11 else req.query.count = parseInt(req.query.count, 10)
13 if (req.query.count > PAGINATION.COUNT.MAX) req.query.count = PAGINATION.COUNT.MAX
18 // ---------------------------------------------------------------------------