Fix COUNT operation on view group aggregate header (#9789)

Fixes
[sentry](https://twenty-v7.sentry.io/issues/6235128210/?referrer=discord&notification_uuid=898a081c-f8c7-42b8-b598-7660470a1975&alert_rule_id=15135099&alert_type=issue)

In a [previous work](https://github.com/twentyhq/twenty/pull/9749) I set
the default field to run totalCount aggregate operation on to the "name"
field, which I was wrong think was present on all objects.
This commit is contained in:
Marie
2025-01-22 15:05:38 +01:00
committed by GitHub
parent 8213995887
commit d759559506
9 changed files with 78 additions and 78 deletions

View File

@ -3,6 +3,7 @@ import { GraphQLISODateTime } from '@nestjs/graphql';
import { GraphQLFloat, GraphQLInt, GraphQLScalarType } from 'graphql';
import {
capitalize,
FIELD_FOR_TOTAL_COUNT_AGGREGATE_OPERATION,
FieldMetadataType,
isFieldMetadataDateKind,
} from 'twenty-shared';
@ -176,7 +177,7 @@ export const getAvailableAggregationsFromObjectFields = (
totalCount: {
type: GraphQLInt,
description: `Total number of records in the connection`,
fromField: 'id',
fromField: FIELD_FOR_TOTAL_COUNT_AGGREGATE_OPERATION,
fromFieldType: FieldMetadataType.UUID,
aggregateOperation: AGGREGATE_OPERATIONS.count,
},