Skip to content

Commit 9b3fc81

Browse files
clean up perPage in Joi
1 parent 170fa40 commit 9b3fc81

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

app-bootstrap.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ const Joi = require('joi')
99
Joi.optionalId = () => Joi.string().uuid()
1010
Joi.id = () => Joi.optionalId().required()
1111
Joi.page = () => Joi.number().integer().min(1).default(1)
12-
Joi.perPage = () => Joi.number().integer().min(1).max(10001).default(config.DEFAULT_PAGE_SIZE)
12+
Joi.perPage = () => Joi.number().integer().min(1).max(10000).default(config.DEFAULT_PAGE_SIZE)

config/default.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = {
66
LOG_LEVEL: process.env.LOG_LEVEL || 'debug',
77
PORT: process.env.PORT || 3000,
88
API_VERSION: process.env.API_VERSION || 'v5',
9-
DEFAULT_PAGE_SIZE: process.env.DEFAULT_PAGE_SIZE || 1000,
9+
DEFAULT_PAGE_SIZE: process.env.DEFAULT_PAGE_SIZE || 50,
1010
// used to properly set the header response to api calls for services behind a load balancer
1111
API_BASE_URL: process.env.API_BASE_URL || `http://localhost:3000`,
1212

src/services/ResourceService.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ getResources.schema = {
179179
challengeId: Joi.id(),
180180
roleId: Joi.optionalId(),
181181
page: Joi.page().default(1),
182-
perPage: Joi.perPage().default(50),
182+
perPage: Joi.perPage(),
183183
// sortBy: Joi.string().valid('memberHandle', 'created').default('created'), // have to reindex to sort by memberHandle
184184
sortBy: Joi.string().valid('created').default('created'),
185185
sortOrder: Joi.string().valid('desc', 'asc').default('asc')
@@ -498,7 +498,7 @@ listChallengesByMember.schema = {
498498
criteria: Joi.object().keys({
499499
resourceRoleId: Joi.string().uuid(),
500500
page: Joi.page().default(1),
501-
perPage: Joi.perPage().default(50)
501+
perPage: Joi.perPage()
502502
}).required()
503503
}
504504

0 commit comments

Comments
 (0)