introproventures / graphql-jpa-query

Generate GraphQL Query Api for your JPA Entity Models
https://github.com/introproventures/graphql-jpa-query
Apache License 2.0
195 stars 54 forks source link

Extract aggregate query fields for nested associations into dedicated by field #490

Closed igdianov closed 4 months ago

igdianov commented 4 months ago

Move all aggregate queries for nested aggregations into dedicated by field to improve schema definition and data fetching for further extension, i.e.

Before:

                query {
                  TaskVariables(
                    # Apply filter criteria
                    where: {name: {IN: ["variable1", "variable5"]}}
                  ) {
                    aggregate {
                      # Count by associated tasks
                      task {
                        by(field: status)
                        count
                      }
                    }
                  }
                }

After

                query {
                  TaskVariables(
                    # Apply filter criteria
                    where: {name: {IN: ["variable1", "variable5"]}}
                  ) {
                    aggregate {
                      # Count by associated tasks
                      by {
                        task {
                          by(field: status)
                          count
                        }
                      }
                    }
                  }
                }