Aggregate queries and field metadata deletion (#9660)
This commit is contained in:
@ -3,6 +3,7 @@ import { Injectable, Logger } from '@nestjs/common';
|
||||
import { isDefined } from 'class-validator';
|
||||
import isEmpty from 'lodash.isempty';
|
||||
|
||||
import { AGGREGATE_OPERATIONS } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
|
||||
import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.manager';
|
||||
|
||||
@Injectable()
|
||||
@ -120,4 +121,26 @@ export class ViewService {
|
||||
})
|
||||
.then((views) => views.map((view) => view.id));
|
||||
}
|
||||
|
||||
async resetKanbanAggregateOperationByFieldMetadataId({
|
||||
workspaceId,
|
||||
fieldMetadataId,
|
||||
}: {
|
||||
workspaceId: string;
|
||||
fieldMetadataId: string;
|
||||
}) {
|
||||
const viewRepository =
|
||||
await this.twentyORMGlobalManager.getRepositoryForWorkspace(
|
||||
workspaceId,
|
||||
'view',
|
||||
);
|
||||
|
||||
await viewRepository.update(
|
||||
{ kanbanAggregateOperationFieldMetadataId: fieldMetadataId },
|
||||
{
|
||||
kanbanAggregateOperationFieldMetadataId: null,
|
||||
kanbanAggregateOperation: AGGREGATE_OPERATIONS.count,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user