-
Notifications
You must be signed in to change notification settings - Fork 17
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
api: refactor pagination #1341
api: refactor pagination #1341
Conversation
Pull Request Test Coverage Report for Build 9562662039Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9564087996Details
💛 - Coveralls |
3f62e25
to
879602e
Compare
Pull Request Test Coverage Report for Build 9579304909Details
💛 - Coveralls |
879602e
to
ca5f160
Compare
Pull Request Test Coverage Report for Build 9580078879Details
💛 - Coveralls |
ca5f160
to
4881fa1
Compare
this PR is far from finished but since the road ahead is just repeating what i did for /elections to the rest of the endpoints, i'd really appreciate some early feedback on the approach taken so far, particularly from @mvdan on the indexer part |
Pull Request Test Coverage Report for Build 9581805081Details
💛 - Coveralls |
5ef60c1
to
7c1ccc6
Compare
Pull Request Test Coverage Report for Build 9605211222Details
💛 - Coveralls |
so far: these endpoints are deprecated
in favor of:
(i added, for completeness, a new endpoint and these endpoints are deprecated
in favor of:
and as a bonus, this endpoint is also deprecated
in favor of:
|
0420689
to
5be4415
Compare
3bb7202
to
fc15db1
Compare
Pull Request Test Coverage Report for Build 9767055171Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9767120622Details
💛 - Coveralls |
fc15db1
to
d3fae84
Compare
Pull Request Test Coverage Report for Build 10110722018Details
💛 - Coveralls |
cdc086b
to
88d4bef
Compare
1814fea
to
a46a92c
Compare
a3a3867
to
c0b932e
Compare
…s fields as hex instead of base64" This reverts commit b46eef4.
64c39dc
to
be916e8
Compare
* add new endpoints, all of them include a `pagination` field in reply, and accept QueryParams: * GET /elections * page * limit * status * organizationId * electionId * withResults * finalResults * manuallyEnded * GET /accounts * page * limit * GET /chain/transactions * page * limit * height * type * GET /chain/organizations * page * limit * organizationId * GET /chain/fees * page * limit * reference * type * accountId * GET /votes * page * limit * electionId * mark all of these endpoints as deprecated on swagger docs: * GET /accounts/page/{page} * GET /accounts/{organizationID}/elections/status/{status}/page/{page} * GET /accounts/{organizationID}/elections/page/{page} * GET /elections/page/{page} * POST /elections/filter/page/{page} * GET /chain/organizations/page/{page} * POST /chain/organizations/filter/page/{page} * GET /elections/{electionId}/votes/page/{page} all of these were anyway refactored in a backwards-compatible manner, to unify pagination logic (adding `pagination` field) * api: return ErrPageNotFound on all paginated endpoints, when page is negative or higher than last_page * api: new param `limit` in all paginated endpoints (defaults to DefaultItemsPerPage if ommitted, and can't surpass hardcoded MaxItemsPerPage) * api: all paginated endpoints return an empty list in case of no results (instead of 404) api internal code refactorings: * api: unify hardcoded structs into a new types: * AccountsList * ElectionsList * OrganizationsList * FeesList * VotesList * TransactionsList * CountResult * api: deduplicate several code snippets, with marshalAndSend and parse* helpers * api: rename const MaxPageSize -> MaxItemsPerPage * api: add Param* consts, and fix case of all URLParams 'ID' -> 'Id' * api: add *Params types (PaginationParams, ElectionParams, etc) * api: fix strings in errors returned to client, replacing "ID" -> "Id" * api: fix swagger docs, replace many occurences of "ID" -> "Id" * api: fix swagger docs, lots of small inaccuracies * test: add TestAPIAccountsList and TestAPIElectionsList indexer changes: * rename GetListAccounts -> AccountList * rename GetEnvelopes -> VoteList * replace GetTokenFees* methods with a single TokenFeesList * methods AccountList, ProcessList, EntityList, VoteList, TokenFeesList now: * return a TotalCount * reordered and renamed args (from, max) -> (limit, offset)
be916e8
to
b510ac8
Compare
No description provided.