[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:
Marie
2025-09-30 17:12:03 +02:00
committed by GitHub
parent 15975a2cfc
commit 3927b36406
88 changed files with 730 additions and 853 deletions
@@ -1,44 +0,0 @@
import { ViewFilterOperand as ViewFilterOperandShared } from 'twenty-shared/types';
import { ViewFilterOperand } from 'src/engine/core-modules/view/enums/view-filter-operand';
export const convertViewFilterOperand = (
operand: ViewFilterOperand,
): ViewFilterOperandShared => {
switch (operand) {
case ViewFilterOperand.IS:
return ViewFilterOperandShared.Is;
case ViewFilterOperand.IS_NOT_NULL:
return ViewFilterOperandShared.IsNotNull;
case ViewFilterOperand.IS_NOT:
return ViewFilterOperandShared.IsNot;
case ViewFilterOperand.LESS_THAN_OR_EQUAL:
return ViewFilterOperandShared.LessThanOrEqual;
case ViewFilterOperand.GREATER_THAN_OR_EQUAL:
return ViewFilterOperandShared.GreaterThanOrEqual;
case ViewFilterOperand.IS_BEFORE:
return ViewFilterOperandShared.IsBefore;
case ViewFilterOperand.IS_AFTER:
return ViewFilterOperandShared.IsAfter;
case ViewFilterOperand.CONTAINS:
return ViewFilterOperandShared.Contains;
case ViewFilterOperand.DOES_NOT_CONTAIN:
return ViewFilterOperandShared.DoesNotContain;
case ViewFilterOperand.IS_EMPTY:
return ViewFilterOperandShared.IsEmpty;
case ViewFilterOperand.IS_NOT_EMPTY:
return ViewFilterOperandShared.IsNotEmpty;
case ViewFilterOperand.IS_RELATIVE:
return ViewFilterOperandShared.IsRelative;
case ViewFilterOperand.IS_IN_PAST:
return ViewFilterOperandShared.IsInPast;
case ViewFilterOperand.IS_IN_FUTURE:
return ViewFilterOperandShared.IsInFuture;
case ViewFilterOperand.IS_TODAY:
return ViewFilterOperandShared.IsToday;
case ViewFilterOperand.VECTOR_SEARCH:
return ViewFilterOperandShared.VectorSearch;
default:
throw new Error(`Invalid view filter operand: ${operand}`);
}
};