Skip to content

Commit

Permalink
fix: define default value, and enhance the validation of limit and of…
Browse files Browse the repository at this point in the history
…fset
  • Loading branch information
WeiyuSun committed Jul 21, 2023
1 parent 31cecbc commit 298c9ae
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions server/handlers/walletHandler/schemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ const Joi = require('joi');
const TrustRelationshipEnums = require('../../utils/trust-enums');

const walletGetQuerySchema = Joi.object({
limit: Joi.number().required(),
offset: Joi.number().integer(),
limit: Joi.number()
.integer().message('limit can only be non-negative integer')
.min(0).message('limit can only be non-negative integer')
.max(Number.MAX_SAFE_INTEGER).message('limit value overflow'),
offset: Joi.number()
.integer().message('offset can only be non-negative integer')
.min(0).message('offset can only be non-negative integer')
.max(Number.MAX_SAFE_INTEGER).message('offset value overflow'),
name: Joi.string(),
});

Expand Down

0 comments on commit 298c9ae

Please sign in to comment.