Added children to resource interface

graph-rework
noah metz 2023-06-21 11:52:30 -06:00
parent 3405521e9f
commit e87f53c22d
1 changed files with 10 additions and 2 deletions

@ -541,6 +541,14 @@ func GQLResourceOwner(p graphql.ResolveParams) (interface{}, error) {
})
}
func GQLResourceChildren(p graphql.ResolveParams) (interface{}, error) {
return GQLResourceFn(p, func(resource Resource, p graphql.ResolveParams) (interface{}, error) {
return resource.Children(), nil
})
}
var gql_type_gql_server *graphql.Object = nil
func GQLTypeGQLServer() * graphql.Object {
if gql_type_gql_server == nil {
@ -579,7 +587,7 @@ func GQLTypeGQLServer() * graphql.Object {
gql_type_gql_server.AddFieldConfig("Children", &graphql.Field{
Type: GQLListResource(),
Resolve: GQLResourceParents,
Resolve: GQLResourceChildren,
})
gql_type_gql_server.AddFieldConfig("Owner", &graphql.Field{
@ -628,7 +636,7 @@ func GQLTypeBaseResource() * graphql.Object {
gql_type_gql_server.AddFieldConfig("Children", &graphql.Field{
Type: GQLListResource(),
Resolve: GQLResourceParents,
Resolve: GQLResourceChildren,
})
gql_type_base_resource.AddFieldConfig("Owner", &graphql.Field{