-
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.
Merge branches 'feat/api-refactor-pagination' and 'feat/index-blocks'…
… into dev
- Loading branch information
Showing
44 changed files
with
1,965 additions
and
974 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
package api | ||
|
||
////// Disabled autoswag due to https://github.com/swaggo/swag/issues/1267 | ||
////// TODO: re-enable when a fixed swaggo/swag is released | ||
////// and remove the workaround done by @selankon on docs/models/models.go | ||
////go:generate go run go.vocdoni.io/dvote/api/autoswag | ||
//go:generate go run github.com/swaggo/swag/cmd/[email protected] fmt | ||
//go:generate go run go.vocdoni.io/dvote/api/autoswag | ||
//go:generate go run github.com/swaggo/swag/cmd/[email protected] fmt | ||
|
||
import ( | ||
"fmt" | ||
|
@@ -50,8 +47,30 @@ import ( | |
|
||
// @securityDefinitions.basic BasicAuth | ||
|
||
// MaxPageSize defines the maximum number of results returned by the paginated endpoints | ||
const MaxPageSize = 10 | ||
const ( | ||
// DefaultItemsPerPage defines how many items per page are returned by the paginated endpoints, | ||
// when the client doesn't specify a `limit` param | ||
DefaultItemsPerPage = 10 | ||
// MaxItemsPerPage defines a ceiling for the `limit` param passed by the client | ||
MaxItemsPerPage = 100 | ||
) | ||
|
||
// These consts define the keywords for query (?param=), url (/url/param/) and POST params. | ||
// Note: In JS/TS acronyms like "ID" are camelCased as in "Id". | ||
// | ||
//nolint:revive | ||
const ( | ||
ParamAccountId = "accountId" | ||
ParamCensusId = "censusId" | ||
ParamElectionId = "electionId" | ||
ParamOrganizationId = "organizationId" | ||
ParamVoteId = "voteId" | ||
ParamPage = "page" | ||
ParamLimit = "limit" | ||
ParamStatus = "status" | ||
ParamWithResults = "withResults" | ||
ParamHeight = "height" | ||
) | ||
|
||
var ( | ||
ErrMissingModulesForHandler = fmt.Errorf("missing modules attached for enabling handler") | ||
|
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.