rename PaginationLimit -> FetchLimit
This commit is contained in:
parent
95dbbc4d8a
commit
1f3450cfca
|
@ -1,5 +1,5 @@
|
|||
package dailyplayerstats
|
||||
|
||||
const (
|
||||
PaginationLimit = 1000
|
||||
FetchLimit = 1000
|
||||
)
|
||||
|
|
|
@ -22,8 +22,8 @@ func (ucase *usecase) Fetch(ctx context.Context, cfg dailyplayerstats.FetchConfi
|
|||
cfg.Filter = &models.DailyPlayerStatsFilter{}
|
||||
}
|
||||
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > dailyplayerstats.PaginationLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = dailyplayerstats.PaginationLimit
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > dailyplayerstats.FetchLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = dailyplayerstats.FetchLimit
|
||||
}
|
||||
cfg.Sort = utils.SanitizeSorts(cfg.Sort)
|
||||
return ucase.repo.Fetch(ctx, cfg)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package dailytribestats
|
||||
|
||||
const (
|
||||
PaginationLimit = 500
|
||||
FetchLimit = 1000
|
||||
)
|
||||
|
|
|
@ -22,8 +22,8 @@ func (ucase *usecase) Fetch(ctx context.Context, cfg dailytribestats.FetchConfig
|
|||
cfg.Filter = &models.DailyTribeStatsFilter{}
|
||||
}
|
||||
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > dailytribestats.PaginationLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = dailytribestats.PaginationLimit
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > dailytribestats.FetchLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = dailytribestats.FetchLimit
|
||||
}
|
||||
cfg.Sort = utils.SanitizeSorts(cfg.Sort)
|
||||
return ucase.repo.Fetch(ctx, cfg)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package ennoblement
|
||||
|
||||
const (
|
||||
PaginationLimit = 200
|
||||
FetchLimit = 200
|
||||
)
|
||||
|
|
|
@ -23,8 +23,8 @@ func (ucase *usecase) Fetch(ctx context.Context, cfg ennoblement.FetchConfig) ([
|
|||
cfg.Filter = &models.EnnoblementFilter{}
|
||||
}
|
||||
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > ennoblement.PaginationLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = ennoblement.PaginationLimit
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > ennoblement.FetchLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = ennoblement.FetchLimit
|
||||
}
|
||||
cfg.Sort = utils.SanitizeSorts(cfg.Sort)
|
||||
return ucase.repo.Fetch(ctx, cfg)
|
||||
|
@ -33,7 +33,7 @@ func (ucase *usecase) Fetch(ctx context.Context, cfg ennoblement.FetchConfig) ([
|
|||
func (ucase *usecase) FetchLiveEnnoblements(ctx context.Context, server string) ([]*models.LiveEnnoblement, error) {
|
||||
limit := 0
|
||||
if !middleware.CanExceedLimit(ctx) {
|
||||
limit = ennoblement.PaginationLimit
|
||||
limit = ennoblement.FetchLimit
|
||||
}
|
||||
ennoblements, _, err := ucase.repo.Fetch(ctx, ennoblement.FetchConfig{
|
||||
Server: server,
|
||||
|
|
|
@ -89,6 +89,9 @@ func getComplexityRoot() generated.ComplexityRoot {
|
|||
complexityRoot.Player.NameChanges = func(childComplexity int) int {
|
||||
return 50 + childComplexity
|
||||
}
|
||||
complexityRoot.Player.Servers = func(childComplexity int) int {
|
||||
return 50 + childComplexity
|
||||
}
|
||||
complexityRoot.Query.DailyPlayerStats = func(
|
||||
childComplexity int,
|
||||
server string,
|
||||
|
@ -211,7 +214,7 @@ func getComplexityRoot() generated.ComplexityRoot {
|
|||
return 100 + childComplexity
|
||||
}
|
||||
complexityRoot.Query.Server = func(childComplexity int, key string) int {
|
||||
return 50 + childComplexity
|
||||
return 10 + childComplexity
|
||||
}
|
||||
complexityRoot.Query.Servers = func(
|
||||
childComplexity int,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package player
|
||||
|
||||
const (
|
||||
PaginationLimit = 200
|
||||
FetchLimit = 200
|
||||
)
|
||||
|
|
|
@ -24,8 +24,8 @@ func (ucase *usecase) Fetch(ctx context.Context, cfg player.FetchConfig) ([]*mod
|
|||
cfg.Filter = &models.PlayerFilter{}
|
||||
}
|
||||
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > player.PaginationLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = player.PaginationLimit
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > player.FetchLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = player.FetchLimit
|
||||
}
|
||||
cfg.Sort = utils.SanitizeSorts(cfg.Sort)
|
||||
return ucase.repo.Fetch(ctx, cfg)
|
||||
|
@ -56,8 +56,8 @@ func (ucase *usecase) SearchPlayer(ctx context.Context, cfg player.SearchPlayerC
|
|||
if "" == strings.TrimSpace(cfg.Name) && cfg.ID <= 0 {
|
||||
return nil, 0, fmt.Errorf("Your search is ambiguous. You must specify the variable 'name' or 'id'.")
|
||||
}
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > player.PaginationLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = player.PaginationLimit
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > player.FetchLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = player.FetchLimit
|
||||
}
|
||||
cfg.Sort = utils.SanitizeSorts(cfg.Sort)
|
||||
return ucase.repo.SearchPlayer(ctx, cfg)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package playerhistory
|
||||
|
||||
const (
|
||||
PaginationLimit = 100
|
||||
FetchLimit = 100
|
||||
)
|
||||
|
|
|
@ -22,8 +22,8 @@ func (ucase *usecase) Fetch(ctx context.Context, cfg playerhistory.FetchConfig)
|
|||
cfg.Filter = &models.PlayerHistoryFilter{}
|
||||
}
|
||||
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > playerhistory.PaginationLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = playerhistory.PaginationLimit
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > playerhistory.FetchLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = playerhistory.FetchLimit
|
||||
}
|
||||
cfg.Sort = utils.SanitizeSorts(cfg.Sort)
|
||||
return ucase.repo.Fetch(ctx, cfg)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package server
|
||||
|
||||
const (
|
||||
PaginationLimit = 100
|
||||
FetchLimit = 100
|
||||
)
|
||||
|
|
|
@ -22,8 +22,8 @@ func (ucase *usecase) Fetch(ctx context.Context, cfg server.FetchConfig) ([]*mod
|
|||
if cfg.Filter == nil {
|
||||
cfg.Filter = &models.ServerFilter{}
|
||||
}
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > server.PaginationLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = server.PaginationLimit
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > server.FetchLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = server.FetchLimit
|
||||
}
|
||||
cfg.Sort = utils.SanitizeSorts(cfg.Sort)
|
||||
return ucase.repo.Fetch(ctx, cfg)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package serverstats
|
||||
|
||||
const (
|
||||
PaginationLimit = 60
|
||||
FetchLimit = 60
|
||||
)
|
||||
|
|
|
@ -22,8 +22,8 @@ func (ucase *usecase) Fetch(ctx context.Context, cfg serverstats.FetchConfig) ([
|
|||
cfg.Filter = &models.ServerStatsFilter{}
|
||||
}
|
||||
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > serverstats.PaginationLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = serverstats.PaginationLimit
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > serverstats.FetchLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = serverstats.FetchLimit
|
||||
}
|
||||
cfg.Sort = utils.SanitizeSorts(cfg.Sort)
|
||||
return ucase.repo.Fetch(ctx, cfg)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package tribe
|
||||
|
||||
const (
|
||||
PaginationLimit = 200
|
||||
FetchLimit = 200
|
||||
)
|
||||
|
|
|
@ -24,8 +24,8 @@ func (ucase *usecase) Fetch(ctx context.Context, cfg tribe.FetchConfig) ([]*mode
|
|||
cfg.Filter = &models.TribeFilter{}
|
||||
}
|
||||
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > tribe.PaginationLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = tribe.PaginationLimit
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > tribe.FetchLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = tribe.FetchLimit
|
||||
}
|
||||
cfg.Sort = utils.SanitizeSorts(cfg.Sort)
|
||||
return ucase.repo.Fetch(ctx, cfg)
|
||||
|
@ -56,8 +56,8 @@ func (ucase *usecase) SearchTribe(ctx context.Context, cfg tribe.SearchTribeConf
|
|||
if "" == strings.TrimSpace(cfg.Query) {
|
||||
return nil, 0, fmt.Errorf("Your search is ambiguous. You must specify the variable 'query'.")
|
||||
}
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > tribe.PaginationLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = tribe.PaginationLimit
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > tribe.FetchLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = tribe.FetchLimit
|
||||
}
|
||||
cfg.Sort = utils.SanitizeSorts(cfg.Sort)
|
||||
return ucase.repo.SearchTribe(ctx, cfg)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package tribechange
|
||||
|
||||
const (
|
||||
PaginationLimit = 100
|
||||
FetchLimit = 100
|
||||
)
|
||||
|
|
|
@ -22,8 +22,8 @@ func (ucase *usecase) Fetch(ctx context.Context, cfg tribechange.FetchConfig) ([
|
|||
cfg.Filter = &models.TribeChangeFilter{}
|
||||
}
|
||||
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > tribechange.PaginationLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = tribechange.PaginationLimit
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > tribechange.FetchLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = tribechange.FetchLimit
|
||||
}
|
||||
cfg.Sort = utils.SanitizeSorts(cfg.Sort)
|
||||
return ucase.repo.Fetch(ctx, cfg)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package tribehistory
|
||||
|
||||
const (
|
||||
PaginationLimit = 100
|
||||
FetchLimit = 100
|
||||
)
|
||||
|
|
|
@ -22,8 +22,8 @@ func (ucase *usecase) Fetch(ctx context.Context, cfg tribehistory.FetchConfig) (
|
|||
cfg.Filter = &models.TribeHistoryFilter{}
|
||||
}
|
||||
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > tribehistory.PaginationLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = tribehistory.PaginationLimit
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > tribehistory.FetchLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = tribehistory.FetchLimit
|
||||
}
|
||||
cfg.Sort = utils.SanitizeSorts(cfg.Sort)
|
||||
return ucase.repo.Fetch(ctx, cfg)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package version
|
||||
|
||||
const (
|
||||
PaginationLimit = 100
|
||||
FetchLimit = 100
|
||||
)
|
||||
|
|
|
@ -26,8 +26,8 @@ func (ucase *usecase) Fetch(ctx context.Context, cfg version.FetchConfig) ([]*mo
|
|||
cfg.Filter = &models.VersionFilter{}
|
||||
}
|
||||
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > version.PaginationLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = version.PaginationLimit
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > version.FetchLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = version.FetchLimit
|
||||
}
|
||||
cfg.Sort = utils.SanitizeSorts(cfg.Sort)
|
||||
return ucase.repo.Fetch(ctx, cfg)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package village
|
||||
|
||||
const (
|
||||
PaginationLimit = 1000
|
||||
FetchLimit = 1000
|
||||
)
|
||||
|
|
|
@ -23,8 +23,8 @@ func (ucase *usecase) Fetch(ctx context.Context, cfg village.FetchConfig) ([]*mo
|
|||
cfg.Filter = &models.VillageFilter{}
|
||||
}
|
||||
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > village.PaginationLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = village.PaginationLimit
|
||||
if !middleware.CanExceedLimit(ctx) && (cfg.Limit > village.FetchLimit || cfg.Limit <= 0) {
|
||||
cfg.Limit = village.FetchLimit
|
||||
}
|
||||
cfg.Sort = utils.SanitizeSorts(cfg.Sort)
|
||||
return ucase.repo.Fetch(ctx, cfg)
|
||||
|
|
Reference in New Issue