Added control state and game state to Match graphql

graph-rework
noah metz 2023-06-08 16:48:28 -06:00
parent be2e227a1d
commit 230f4a88eb
1 changed files with 23 additions and 1 deletions

@ -40,6 +40,18 @@ func GQLVexMatchArena(p graphql.ResolveParams) (interface{}, error) {
})
}
func GQLVexMatchControl(p graphql.ResolveParams) (interface{}, error) {
return GQLEventFn(p, func(event Event, p graphql.ResolveParams) (interface{}, error) {
return event.(*Match).control, nil
})
}
func GQLVexMatchState(p graphql.ResolveParams) (interface{}, error) {
return GQLEventFn(p, func(event Event, p graphql.ResolveParams) (interface{}, error) {
return event.(*Match).state, nil
})
}
func GQLVexAllianceTeams(p graphql.ResolveParams) (interface{}, error) {
return GQLResourceFn(p, func(resource Resource, p graphql.ResolveParams) (interface{}, error) {
return resource.(*Alliance).teams, nil
@ -126,9 +138,19 @@ func GQLVexTypeMatch() * graphql.Object {
})
gql_vex_type_match.AddFieldConfig("Arena", &graphql.Field{
Type: GQLVexTypeArena(),
Type: graphql.String,
Resolve: GQLVexMatchArena,
})
gql_vex_type_match.AddFieldConfig("Control", &graphql.Field{
Type: graphql.String,
Resolve: GQLVexMatchControl,
})
gql_vex_type_match.AddFieldConfig("State", &graphql.Field{
Type: graphql.String,
Resolve: GQLVexMatchState,
})
}
return gql_vex_type_match