From 230f4a88eb18b7b72d84d79492d4459c63c798b8 Mon Sep 17 00:00:00 2001 From: Noah Metz Date: Thu, 8 Jun 2023 16:48:28 -0600 Subject: [PATCH] Added control state and game state to Match graphql --- gql_vex.go | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/gql_vex.go b/gql_vex.go index aeb0e93..f60c22e 100644 --- a/gql_vex.go +++ b/gql_vex.go @@ -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