rename graphql type ServerStatsList to ServerStats

This commit is contained in:
Dawid Wysokiński 2020-06-21 14:45:41 +02:00
parent 27c2c827b4
commit 4f29d21bcc
4 changed files with 31 additions and 31 deletions

View File

@ -348,7 +348,7 @@ type ComplexityRoot struct {
Check func(childComplexity int) int Check func(childComplexity int) int
} }
ServerStatsList struct { ServerStats struct {
Items func(childComplexity int) int Items func(childComplexity int) int
Total func(childComplexity int) int Total func(childComplexity int) int
} }
@ -493,7 +493,7 @@ type QueryResolver interface {
PlayerHistory(ctx context.Context, server string, filter *models.PlayerHistoryFilter) (*PlayerHistory, error) PlayerHistory(ctx context.Context, server string, filter *models.PlayerHistoryFilter) (*PlayerHistory, error)
Servers(ctx context.Context, filter *models.ServerFilter) (*ServersList, error) Servers(ctx context.Context, filter *models.ServerFilter) (*ServersList, error)
Server(ctx context.Context, key string) (*models.Server, error) Server(ctx context.Context, key string) (*models.Server, error)
ServerStats(ctx context.Context, server string, filter *models.ServerStatsFilter) (*ServerStatsList, error) ServerStats(ctx context.Context, server string, filter *models.ServerStatsFilter) (*ServerStats, error)
Tribes(ctx context.Context, server string, filter *models.TribeFilter) (*TribesList, error) Tribes(ctx context.Context, server string, filter *models.TribeFilter) (*TribesList, error)
Tribe(ctx context.Context, server string, id int) (*models.Tribe, error) Tribe(ctx context.Context, server string, id int) (*models.Tribe, error)
TribeHistory(ctx context.Context, server string, filter *models.TribeHistoryFilter) (*TribeHistory, error) TribeHistory(ctx context.Context, server string, filter *models.TribeHistoryFilter) (*TribeHistory, error)
@ -2121,19 +2121,19 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.ServerConfigWin.Check(childComplexity), true return e.complexity.ServerConfigWin.Check(childComplexity), true
case "ServerStatsList.items": case "ServerStats.items":
if e.complexity.ServerStatsList.Items == nil { if e.complexity.ServerStats.Items == nil {
break break
} }
return e.complexity.ServerStatsList.Items(childComplexity), true return e.complexity.ServerStats.Items(childComplexity), true
case "ServerStatsList.total": case "ServerStats.total":
if e.complexity.ServerStatsList.Total == nil { if e.complexity.ServerStats.Total == nil {
break break
} }
return e.complexity.ServerStatsList.Total(childComplexity), true return e.complexity.ServerStats.Total(childComplexity), true
case "ServerStatsRecord.activePlayers": case "ServerStatsRecord.activePlayers":
if e.complexity.ServerStatsRecord.ActivePlayers == nil { if e.complexity.ServerStatsRecord.ActivePlayers == nil {
@ -3229,7 +3229,7 @@ type ServerConfig {
createdAt: Time! @goField(forceResolver: true) createdAt: Time! @goField(forceResolver: true)
} }
type ServerStatsList { type ServerStats {
items: [ServerStatsRecord!] items: [ServerStatsRecord!]
total: Int! total: Int!
} }
@ -3247,7 +3247,7 @@ input ServerStatsFilter {
} }
extend type Query { extend type Query {
serverStats(server: String!, filter: ServerStatsFilter): ServerStatsList! serverStats(server: String!, filter: ServerStatsFilter): ServerStats!
} }
`, BuiltIn: false}, `, BuiltIn: false},
&ast.Source{Name: "schema/tribe.graphql", Input: `type Tribe { &ast.Source{Name: "schema/tribe.graphql", Input: `type Tribe {
@ -6907,9 +6907,9 @@ func (ec *executionContext) _Query_serverStats(ctx context.Context, field graphq
} }
return graphql.Null return graphql.Null
} }
res := resTmp.(*ServerStatsList) res := resTmp.(*ServerStats)
fc.Result = res fc.Result = res
return ec.marshalNServerStatsList2ᚖgithubᚗcomᚋtribalwarshelpᚋapiᚋgraphqlᚋgeneratedᚐServerStatsList(ctx, field.Selections, res) return ec.marshalNServerStats2ᚖgithubᚗcomᚋtribalwarshelpᚋapiᚋgraphqlᚋgeneratedᚐServerStats(ctx, field.Selections, res)
} }
func (ec *executionContext) _Query_tribes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { func (ec *executionContext) _Query_tribes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
@ -11291,7 +11291,7 @@ func (ec *executionContext) _ServerConfigWin_check(ctx context.Context, field gr
return ec.marshalNInt2int(ctx, field.Selections, res) return ec.marshalNInt2int(ctx, field.Selections, res)
} }
func (ec *executionContext) _ServerStatsList_items(ctx context.Context, field graphql.CollectedField, obj *ServerStatsList) (ret graphql.Marshaler) { func (ec *executionContext) _ServerStats_items(ctx context.Context, field graphql.CollectedField, obj *ServerStats) (ret graphql.Marshaler) {
defer func() { defer func() {
if r := recover(); r != nil { if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r)) ec.Error(ctx, ec.Recover(ctx, r))
@ -11299,7 +11299,7 @@ func (ec *executionContext) _ServerStatsList_items(ctx context.Context, field gr
} }
}() }()
fc := &graphql.FieldContext{ fc := &graphql.FieldContext{
Object: "ServerStatsList", Object: "ServerStats",
Field: field, Field: field,
Args: nil, Args: nil,
IsMethod: false, IsMethod: false,
@ -11322,7 +11322,7 @@ func (ec *executionContext) _ServerStatsList_items(ctx context.Context, field gr
return ec.marshalOServerStatsRecord2ᚕᚖgithubᚗcomᚋtribalwarshelpᚋsharedᚋmodelsᚐServerStatsᚄ(ctx, field.Selections, res) return ec.marshalOServerStatsRecord2ᚕᚖgithubᚗcomᚋtribalwarshelpᚋsharedᚋmodelsᚐServerStatsᚄ(ctx, field.Selections, res)
} }
func (ec *executionContext) _ServerStatsList_total(ctx context.Context, field graphql.CollectedField, obj *ServerStatsList) (ret graphql.Marshaler) { func (ec *executionContext) _ServerStats_total(ctx context.Context, field graphql.CollectedField, obj *ServerStats) (ret graphql.Marshaler) {
defer func() { defer func() {
if r := recover(); r != nil { if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r)) ec.Error(ctx, ec.Recover(ctx, r))
@ -11330,7 +11330,7 @@ func (ec *executionContext) _ServerStatsList_total(ctx context.Context, field gr
} }
}() }()
fc := &graphql.FieldContext{ fc := &graphql.FieldContext{
Object: "ServerStatsList", Object: "ServerStats",
Field: field, Field: field,
Args: nil, Args: nil,
IsMethod: false, IsMethod: false,
@ -18429,21 +18429,21 @@ func (ec *executionContext) _ServerConfigWin(ctx context.Context, sel ast.Select
return out return out
} }
var serverStatsListImplementors = []string{"ServerStatsList"} var serverStatsImplementors = []string{"ServerStats"}
func (ec *executionContext) _ServerStatsList(ctx context.Context, sel ast.SelectionSet, obj *ServerStatsList) graphql.Marshaler { func (ec *executionContext) _ServerStats(ctx context.Context, sel ast.SelectionSet, obj *ServerStats) graphql.Marshaler {
fields := graphql.CollectFields(ec.OperationContext, sel, serverStatsListImplementors) fields := graphql.CollectFields(ec.OperationContext, sel, serverStatsImplementors)
out := graphql.NewFieldSet(fields) out := graphql.NewFieldSet(fields)
var invalids uint32 var invalids uint32
for i, field := range fields { for i, field := range fields {
switch field.Name { switch field.Name {
case "__typename": case "__typename":
out.Values[i] = graphql.MarshalString("ServerStatsList") out.Values[i] = graphql.MarshalString("ServerStats")
case "items": case "items":
out.Values[i] = ec._ServerStatsList_items(ctx, field, obj) out.Values[i] = ec._ServerStats_items(ctx, field, obj)
case "total": case "total":
out.Values[i] = ec._ServerStatsList_total(ctx, field, obj) out.Values[i] = ec._ServerStats_total(ctx, field, obj)
if out.Values[i] == graphql.Null { if out.Values[i] == graphql.Null {
invalids++ invalids++
} }
@ -19599,18 +19599,18 @@ func (ec *executionContext) marshalNServerConfigWin2githubᚗcomᚋtribalwarshel
return ec._ServerConfigWin(ctx, sel, &v) return ec._ServerConfigWin(ctx, sel, &v)
} }
func (ec *executionContext) marshalNServerStatsList2githubᚗcomᚋtribalwarshelpᚋapiᚋgraphqlᚋgeneratedᚐServerStatsList(ctx context.Context, sel ast.SelectionSet, v ServerStatsList) graphql.Marshaler { func (ec *executionContext) marshalNServerStats2githubᚗcomᚋtribalwarshelpᚋapiᚋgraphqlᚋgeneratedᚐServerStats(ctx context.Context, sel ast.SelectionSet, v ServerStats) graphql.Marshaler {
return ec._ServerStatsList(ctx, sel, &v) return ec._ServerStats(ctx, sel, &v)
} }
func (ec *executionContext) marshalNServerStatsList2ᚖgithubᚗcomᚋtribalwarshelpᚋapiᚋgraphqlᚋgeneratedᚐServerStatsList(ctx context.Context, sel ast.SelectionSet, v *ServerStatsList) graphql.Marshaler { func (ec *executionContext) marshalNServerStats2ᚖgithubᚗcomᚋtribalwarshelpᚋapiᚋgraphqlᚋgeneratedᚐServerStats(ctx context.Context, sel ast.SelectionSet, v *ServerStats) graphql.Marshaler {
if v == nil { if v == nil {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null") ec.Errorf(ctx, "must not be null")
} }
return graphql.Null return graphql.Null
} }
return ec._ServerStatsList(ctx, sel, v) return ec._ServerStats(ctx, sel, v)
} }
func (ec *executionContext) marshalNServerStatsRecord2githubᚗcomᚋtribalwarshelpᚋsharedᚋmodelsᚐServerStats(ctx context.Context, sel ast.SelectionSet, v models.ServerStats) graphql.Marshaler { func (ec *executionContext) marshalNServerStatsRecord2githubᚗcomᚋtribalwarshelpᚋsharedᚋmodelsᚐServerStats(ctx context.Context, sel ast.SelectionSet, v models.ServerStats) graphql.Marshaler {

View File

@ -26,7 +26,7 @@ type PlayersList struct {
Total int `json:"total"` Total int `json:"total"`
} }
type ServerStatsList struct { type ServerStats struct {
Items []*models.ServerStats `json:"items"` Items []*models.ServerStats `json:"items"`
Total int `json:"total"` Total int `json:"total"`
} }

View File

@ -15,9 +15,9 @@ func (r *serverStatsRecordResolver) CreatedAt(ctx context.Context, obj *models.S
return &t, nil return &t, nil
} }
func (r *Resolver) ServerStats(ctx context.Context, server string, filter *models.ServerStatsFilter) (*generated.ServerStatsList, error) { func (r *Resolver) ServerStats(ctx context.Context, server string, filter *models.ServerStatsFilter) (*generated.ServerStats, error) {
var err error var err error
list := &generated.ServerStatsList{} list := &generated.ServerStats{}
list.Items, list.Total, err = r.ServerStatsUcase.Fetch(ctx, server, filter) list.Items, list.Total, err = r.ServerStatsUcase.Fetch(ctx, server, filter)
return list, err return list, err
} }

View File

@ -12,7 +12,7 @@ type ServerStatsRecord {
createdAt: Time! @goField(forceResolver: true) createdAt: Time! @goField(forceResolver: true)
} }
type ServerStatsList { type ServerStats {
items: [ServerStatsRecord!] items: [ServerStatsRecord!]
total: Int! total: Int!
} }
@ -30,5 +30,5 @@ input ServerStatsFilter {
} }
extend type Query { extend type Query {
serverStats(server: String!, filter: ServerStatsFilter): ServerStatsList! serverStats(server: String!, filter: ServerStatsFilter): ServerStats!
} }