aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/initializers/constants.js4
-rw-r--r--server/middlewares/pagination.js4
2 files changed, 7 insertions, 1 deletions
diff --git a/server/initializers/constants.js b/server/initializers/constants.js
index bb141456a..48e660fe2 100644
--- a/server/initializers/constants.js
+++ b/server/initializers/constants.js
@@ -9,6 +9,9 @@ let FRIEND_BASE_SCORE = 100
9// Time to wait between requests to the friends 9// Time to wait between requests to the friends
10let INTERVAL = 60000 10let INTERVAL = 60000
11 11
12// Number of results by default for the pagination
13const PAGINATION_COUNT_DEFAULT = 15
14
12// Number of points we add/remove from a friend after a successful/bad request 15// Number of points we add/remove from a friend after a successful/bad request
13const PODS_SCORE = { 16const PODS_SCORE = {
14 MALUS: -10, 17 MALUS: -10,
@@ -37,6 +40,7 @@ module.exports = {
37 API_VERSION: API_VERSION, 40 API_VERSION: API_VERSION,
38 FRIEND_BASE_SCORE: FRIEND_BASE_SCORE, 41 FRIEND_BASE_SCORE: FRIEND_BASE_SCORE,
39 INTERVAL: INTERVAL, 42 INTERVAL: INTERVAL,
43 PAGINATION_COUNT_DEFAULT: PAGINATION_COUNT_DEFAULT,
40 PODS_SCORE: PODS_SCORE, 44 PODS_SCORE: PODS_SCORE,
41 REQUEST_RETRIES: REQUEST_RETRIES, 45 REQUEST_RETRIES: REQUEST_RETRIES,
42 THUMBNAILS_SIZE: THUMBNAILS_SIZE, 46 THUMBNAILS_SIZE: THUMBNAILS_SIZE,
diff --git a/server/middlewares/pagination.js b/server/middlewares/pagination.js
index 2a426ec28..9fa43f008 100644
--- a/server/middlewares/pagination.js
+++ b/server/middlewares/pagination.js
@@ -1,5 +1,7 @@
1'use strict' 1'use strict'
2 2
3const constants = require('../initializers/constants')
4
3const paginationMiddleware = { 5const paginationMiddleware = {
4 setPagination: setPagination 6 setPagination: setPagination
5} 7}
@@ -7,7 +9,7 @@ const paginationMiddleware = {
7function setPagination (req, res, next) { 9function setPagination (req, res, next) {
8 if (!req.query.start) req.query.start = 0 10 if (!req.query.start) req.query.start = 0
9 else req.query.start = parseInt(req.query.start) 11 else req.query.start = parseInt(req.query.start)
10 if (!req.query.count) req.query.count = 15 12 if (!req.query.count) req.query.count = constants.PAGINATION_COUNT_DEFAULT
11 else req.query.count = parseInt(req.query.count) 13 else req.query.count = parseInt(req.query.count)
12 14
13 return next() 15 return next()