Skip to content

Add maxLimit server configuration #4048

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 2, 2017

Conversation

copterchris
Copy link
Contributor

Adding an optional server configuration parameter 'maxLimit' to specify the maximum number of records that can be retrieved in a single request. When specified, any attempt to specify a limit greater than the configured number will result in that limit being silently replaced by the configured maximum (i.e the request will not be rejected, but will be limited to the configured maximum).

Copy link
Contributor

@flovilmart flovilmart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small change for the test otherwise that’s a great addition!

src/Config.js Outdated
@@ -220,6 +224,14 @@ export class Config {
}
}

static validateMaxLimit(maxLimit) {
if (maxLimit) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test with server configured with maxLimit: 0? This will probably not throw as not goin in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch - I've updated the tests and code accordingly. lint also pointed out some spacing inconsistencies in files unrelated to my change so I updated those files too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I reverted the indentation updates as they were triggered by a new version of eslint. The CI servers don't have that version yet so builds of my last set of changes were failing.

@codecov
Copy link

codecov bot commented Jul 25, 2017

Codecov Report

Merging #4048 into master will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4048      +/-   ##
==========================================
+ Coverage   92.08%   92.12%   +0.03%     
==========================================
  Files         116      116              
  Lines        7960     7974      +14     
==========================================
+ Hits         7330     7346      +16     
+ Misses        630      628       -2
Impacted Files Coverage Δ
src/cli/definitions/parse-server.js 100% <ø> (ø) ⬆️
src/ParseServer.js 88.75% <ø> (ø) ⬆️
src/Routers/ClassesRouter.js 93.5% <100%> (+0.17%) ⬆️
src/Config.js 95.3% <100%> (+0.12%) ⬆️
src/middlewares.js 97.46% <0%> (-0.02%) ⬇️
src/LiveQuery/Client.js 97.67% <0%> (+0.05%) ⬆️
src/Adapters/Storage/Mongo/MongoTransform.js 85% <0%> (+0.05%) ⬆️
src/RestWrite.js 92.68% <0%> (+0.18%) ⬆️
src/LiveQuery/ParseLiveQueryServer.js 86.48% <0%> (+0.27%) ⬆️
src/Adapters/Auth/meetup.js 89.47% <0%> (+5.26%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 952e64d...6df9a52. Read the comment docs.

@copterchris
Copy link
Contributor Author

copterchris commented Jul 26, 2017

I found that eslint 4.3.0 has made a non-backward-compatible change to its indent rules logic and rejects code in the latest master of parse-server. It looks like 4.3.0 hasn't made it to the CI servers yet so I downgraded my local version to 4.2.0 to allow tests to pass for me locally. I've not modified package.json so you can expect parse-server builds to fail when npm install pulls in 4.3.0

@copterchris
Copy link
Contributor Author

@flovilmart - requested changes have been made, ready for re-review whenever you have time - thanks!

@flovilmart
Copy link
Contributor

@copterchris I updated the branch to match with master, waiting for the tests to run and merging.

@flovilmart flovilmart merged commit 23bffc8 into parse-community:master Oct 2, 2017
@copterchris copterchris deleted the maxlimit branch December 27, 2017 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants