From 3ad0d674dc251407c64b39d4c4830aa038a44874 Mon Sep 17 00:00:00 2001 From: deanchen Date: Wed, 16 Mar 2022 15:14:36 +0800 Subject: [PATCH] fix: limit open --- __tests__/api-tests/earnings-api.spec.js | 4 ++-- server/handlers/earningsHandler.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/__tests__/api-tests/earnings-api.spec.js b/__tests__/api-tests/earnings-api.spec.js index f50e8f4..7fa9814 100644 --- a/__tests__/api-tests/earnings-api.spec.js +++ b/__tests__/api-tests/earnings-api.spec.js @@ -378,11 +378,11 @@ describe('Earnings API tests.', () => { }); }); - it(`Should raise validation error with error code 422 -- 'limit' query parameter should be less than 101 `, function (done) { + it(`Should raise validation error with error code 422 -- 'limit' query parameter should be less than 1000000 `, function (done) { request(server) .get(`/earnings`) .query({ - limit: 101, + limit: 1000000+1, }) .set('Accept', 'application/json') .set('Authorization', jwtToken) diff --git a/server/handlers/earningsHandler.js b/server/handlers/earningsHandler.js index c494354..1114bf5 100644 --- a/server/handlers/earningsHandler.js +++ b/server/handlers/earningsHandler.js @@ -27,7 +27,7 @@ const earningsGetQuerySchema = Joi.object({ contract_id: Joi.string().uuid(), start_date: Joi.date().iso(), end_date: Joi.date().iso(), - limit: Joi.number().integer().greater(0).less(101), + limit: Joi.number().integer().greater(0).less(100000), offset: Joi.number().integer().greater(-1), sort_by: Joi.string().valid( 'id',