Fixed valid_events and valid_resources

graph-rework
noah metz 2023-06-19 15:43:04 -06:00
parent de8b9aa452
commit fcd27be3de
1 changed files with 4 additions and 2 deletions

@ -933,10 +933,12 @@ func MakeGQLHandlers(server * GQLServer) (func(http.ResponseWriter, *http.Reques
valid_resources[reflect.TypeOf((*BaseResource)(nil))] = GQLTypeBaseResource() valid_resources[reflect.TypeOf((*BaseResource)(nil))] = GQLTypeBaseResource()
gql_types := []graphql.Type{GQLTypeBaseEvent(), GQLTypeEventQueue(), GQLTypeSignal(), GQLTypeSignalInput(), GQLTypeBaseNode()} gql_types := []graphql.Type{GQLTypeBaseEvent(), GQLTypeEventQueue(), GQLTypeSignal(), GQLTypeSignalInput(), GQLTypeBaseNode()}
event_type := reflect.TypeOf((Event)(nil))
resource_type := reflect.TypeOf((Resource)(nil))
for go_t, gql_t := range(server.extended_types) { for go_t, gql_t := range(server.extended_types) {
if _, ok := go_t.(Event); ok { if go_t.Implements(event_type) {
valid_events[go_t] = gql_t valid_events[go_t] = gql_t
} else if _, ok := go_t.(Resource); ok { } else if go_t.Implements(resource_type) {
valid_resources[go_t] = gql_t valid_resources[go_t] = gql_t
} }
gql_types = append(gql_types, gql_t) gql_types = append(gql_types, gql_t)