-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
api: general refactor (pagination, query params)
* indexer: rename GetListAccounts -> AccountsList * indexer: rename GetEnvelopes -> VoteList * indexer: replace GetTokenFees* methods with a single TokenFeesList * indexer: AccountsList, ProcessList, EntityList, VoteList, TokenFeesList now return a TotalCount * indexer: EntityList inverted order of args (from, max) to be consistent with others * test: add TestAPIAccountsList and TestAPIElectionsList * api: unify hardcoded structs into a new types: * AccountsList * ElectionsList * OrganizationsList * FeesList * CountResult * api: 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 * GET /chain/organizations * page * limit * organizationId * GET /votes * page * limit * electionId * GET /chain/fees * page * limit * reference * type * accountId * api: refactor filtered endpoints to unify pagination logic (and add `pagination` field): * 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 /accounts/page/{page} * GET /elections/{electionId}/votes/page/{page} also, marked all of these endpoints as deprecated on swagger docs * api: return ErrPageNotFound on paginated endpoints, when page is negative or higher than last_page * 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: 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: 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
- Loading branch information
Showing
33 changed files
with
2,057 additions
and
1,387 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.