// Time to wait between requests to the friends
let INTERVAL = 60000
+// Number of results by default for the pagination
+const PAGINATION_COUNT_DEFAULT = 15
+
// Number of points we add/remove from a friend after a successful/bad request
const PODS_SCORE = {
MALUS: -10,
API_VERSION: API_VERSION,
FRIEND_BASE_SCORE: FRIEND_BASE_SCORE,
INTERVAL: INTERVAL,
+ PAGINATION_COUNT_DEFAULT: PAGINATION_COUNT_DEFAULT,
PODS_SCORE: PODS_SCORE,
REQUEST_RETRIES: REQUEST_RETRIES,
THUMBNAILS_SIZE: THUMBNAILS_SIZE,
'use strict'
+const constants = require('../initializers/constants')
+
const paginationMiddleware = {
setPagination: setPagination
}
function setPagination (req, res, next) {
if (!req.query.start) req.query.start = 0
else req.query.start = parseInt(req.query.start)
- if (!req.query.count) req.query.count = 15
+ if (!req.query.count) req.query.count = constants.PAGINATION_COUNT_DEFAULT
else req.query.count = parseInt(req.query.count)
return next()