twenty
twenty copied to clipboard
🧮 Aggregate queries
Our GraphQL API should support aggregate queries on findMany queries.
We already have totalCount
so we can take inspiration from that.
But it's significantly more challenging because the aggregated fields name are dynamic and depend on the object names themselves. Here's how it could look like:
query {
companies {
edges {
node {
id
domainName {
primaryLinkLabel
}
people {
totalCount
maxCreatedAt
}
}
}
totalCount
maxCreatedAt
}
}
We'll need to add: min
, max
, avg
, sum
, countDistinct