Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
roneli committed Mar 16, 2024
1 parent 5374ac1 commit eb74474
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/execution/execution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ func TestPostgresGraph(t *testing.T) {
},
{
name: "FetchPostsWithAggregateSumAvg",
query: &graphql.RawParams{Query: `query { posts(orderBy: {name: DESC}) { categories { name } _categoriesAggregate(filter: {name: {like: "%w%"}}) { count sum { id } avg { id } } }}`},
want: "",
query: &graphql.RawParams{Query: `query { posts(orderBy: {name: DESC}) { categories { name } _categoriesAggregate { count sum { id } avg { id } } }}`},
want: `{"data":{"posts":[{"categories":[{"name":"Science"},{"name":"Sports"}],"_categoriesAggregate":[{"count":2,"sum":{"id":7},"avg":{"id":3.5}}]},{"categories":[{"name":"Entertainment"},{"name":"News"}],"_categoriesAggregate":[{"count":2,"sum":{"id":6},"avg":{"id":3}}]},{"categories":[{"name":"News"},{"name":"Technology"}],"_categoriesAggregate":[{"count":2,"sum":{"id":3},"avg":{"id":1.5}}]},{"categories":[{"name":"Technology"},{"name":"Science"}],"_categoriesAggregate":[{"count":2,"sum":{"id":5},"avg":{"id":2.5}}]},{"categories":[{"name":"Sports"},{"name":"Entertainment"}],"_categoriesAggregate":[{"count":2,"sum":{"id":9},"avg":{"id":4.5}}]}]}}`,
statusCode: 200,
},
{
Expand Down
2 changes: 1 addition & 1 deletion pkg/schema/aggregation.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func addAggregateObject(s *ast.Schema, obj *ast.Definition) *ast.Definition {
if af == nil {
continue
}
payloadObject.Fields = append(payloadObject.Fields)
payloadObject.Fields = append(payloadObject.Fields, af)
}
s.Types[payloadObjectName] = payloadObject
return payloadObject
Expand Down

0 comments on commit eb74474

Please sign in to comment.