create groupBy resolver + mock groupBy service (#14530)
To test :
```
query :
query companiesGroupBy($groupBy: CompanyGroupByInput){
companiesGroupBy(groupBy: $groupBy){
groupByDimensionValues
countEmptyId
sumAnnualRecurringRevenueAmountMicros
countEmptyAddress
percentageEmptySearchVector
}
}
input :
{"groupBy": {"name": true, "employees": true, "domainName": {"primaryLinkUrl": true}}}
response :
{
"data": {
"companiesGroupBy": [
{
"groupByDimensionValues": [
"Text 1",
"twenty.com",
"1"
],
"countEmptyId": 39,
"sumAnnualRecurringRevenueAmountMicros": 20,
"countEmptyAddress": 56,
"percentageEmptySearchVector": 88
},
{
"groupByDimensionValues": [
"Long long long long and long text 2",
"github.com/twentyhq/twenty",
"2"
],
"countEmptyId": 20,
"sumAnnualRecurringRevenueAmountMicros": 56,
"countEmptyAddress": 88,
"percentageEmptySearchVector": 2
},
{
"groupByDimensionValues": [
"Text 3",
"react.dev",
"3"
],
"countEmptyId": 56,
"sumAnnualRecurringRevenueAmountMicros": 88,
"countEmptyAddress": 2,
"percentageEmptySearchVector": 39
}
]
}
}
```
closes https://github.com/twentyhq/core-team-issues/issues/1439
This commit is contained in:
+21
@@ -161,6 +161,27 @@ export const getResolverArgs = (
|
||||
isNullable: true,
|
||||
},
|
||||
};
|
||||
case 'groupBy':
|
||||
return {
|
||||
groupBy: {
|
||||
kind: GqlInputTypeDefinitionKind.GroupBy,
|
||||
isNullable: false,
|
||||
isArray: true,
|
||||
},
|
||||
filter: {
|
||||
kind: GqlInputTypeDefinitionKind.Filter,
|
||||
isNullable: true,
|
||||
},
|
||||
orderBy: {
|
||||
kind: GqlInputTypeDefinitionKind.OrderBy,
|
||||
isNullable: true,
|
||||
isArray: true,
|
||||
},
|
||||
viewId: {
|
||||
type: UUIDScalarType,
|
||||
isNullable: true,
|
||||
},
|
||||
};
|
||||
default:
|
||||
throw new Error(`Unknown resolver type: ${type}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user