[View migration] Clean ViewFilterOperand (#14785)
In the BE we have stored filter operand as IS_EMPTY, IS_NOT_EMPTY, etc. For some reason in the FE we were manipulating IsEmpty, IsNotEmpty, etc. (maybe because they were used before in Views before they were moved to core) So we were converting the operands in the FE from IS to Is (convertViewFilterOperandFromCore) to read and manipulate viewFilters, and then back to BE version to send mutations etc., from Is to IS (convertViewFilterOperandToCore). The migration is now over, so we can remove and simplify that code. (In the 1-5:migrate-views-to-core command we still do the migration from Is format to IS format.)
This commit is contained in:
+1
-5
@@ -1,5 +1,4 @@
|
||||
import { isString } from '@sniptt/guards';
|
||||
import { type ViewFilterOperand as SharedViewFilterOperand } from 'twenty-shared/types';
|
||||
import { type DataSource, type QueryRunner } from 'typeorm';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
@@ -29,7 +28,6 @@ import { workflowRunsAllView } from 'src/engine/workspace-manager/standard-objec
|
||||
import { workflowVersionsAllView } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/workflow-versions-all.view';
|
||||
import { workflowsAllView } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/workflows-all.view';
|
||||
import { ViewOpenRecordInType } from 'src/modules/view/standard-objects/view.workspace-entity';
|
||||
import { convertViewFilterOperandToCoreOperand } from 'src/modules/view/utils/convert-view-filter-operand-to-core-operand.util';
|
||||
|
||||
type PrefillCoreViewsArgs = {
|
||||
coreDataSource: DataSource;
|
||||
@@ -176,9 +174,7 @@ const createCoreViews = async (
|
||||
viewDefinition.filters.map((filter) => ({
|
||||
fieldMetadataId: filter.fieldMetadataId,
|
||||
viewId: viewDefinition.id,
|
||||
operand: convertViewFilterOperandToCoreOperand(
|
||||
filter.operand as SharedViewFilterOperand,
|
||||
),
|
||||
operand: filter.operand,
|
||||
value: filter.value,
|
||||
workspaceId,
|
||||
}));
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
import { type MessageDescriptor } from '@lingui/core';
|
||||
import { type ViewFilterOperand } from 'twenty-shared/types';
|
||||
|
||||
import { type AggregateOperations } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
|
||||
import { type ViewOpenRecordInType } from 'src/modules/view/standard-objects/view.workspace-entity';
|
||||
@@ -26,7 +27,7 @@ export interface ViewDefinition {
|
||||
filters?: {
|
||||
fieldMetadataId: string;
|
||||
displayValue: string;
|
||||
operand: string;
|
||||
operand: ViewFilterOperand;
|
||||
value: string;
|
||||
}[];
|
||||
groups?: {
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { ViewFilterOperand } from 'twenty-shared/types';
|
||||
|
||||
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
import {
|
||||
@@ -34,7 +35,7 @@ export const tasksAssignedToMeView = (
|
||||
(field) => field.standardId === TASK_STANDARD_FIELD_IDS.assignee,
|
||||
)?.id ?? '',
|
||||
displayValue: 'Me',
|
||||
operand: 'is',
|
||||
operand: ViewFilterOperand.IS,
|
||||
value: JSON.stringify({
|
||||
isCurrentWorkspaceMemberSelected: true,
|
||||
selectedRecordIds: [],
|
||||
|
||||
Reference in New Issue
Block a user