[GQL_VIEW_FILTER_API_BREAKING_CHANGE][WHEN_RELEASED_REQUIRES_CACHE_FLUSH] ViewFilter migration to workspace migration v2 (#15010)

# Introduction
Migrating `viewFilter` to v2 in order to migrate later the field update
side effect on view to v2 too

## What's done
- Created flat-view-filter
- flat view filter runner
- flat view filter builder
- create view filter service v2 and input transpilers
- refactor the existing view filter resolver to fix standard (
BREAKING_CHANGE on graphql api update especially ) REST stays the same
- refactored the front to consume the mutations autogenerated

## New generic tools
### Compare two flat entity
Introducing a new util to compare two flat entity, it's strictly typed
and will be added to the generic builder in a following PR
This will ease flat entity addition as won't required to create a
specific abstraction for comparison
Generic builder will expect specific constant: properties to compare and
properties to stringify

### Transform flat entity for comparison
Forked and refactor the initial existing method for flat entity business
scope and type safety

## Coverage
Migrated existing integration tests to fit new contract API
This PR does not add strong coverage on validation exceptions
Deadlines are too short

close https://github.com/twentyhq/core-team-issues/issues/1666
This commit is contained in:
Paul Rastoin
2025-10-10 15:02:14 +02:00
committed by GitHub
parent 37473175a0
commit 651ab184a7
97 changed files with 3012 additions and 620 deletions
@@ -1,25 +0,0 @@
import gql from 'graphql-tag';
import { VIEW_FILTER_GQL_FIELDS } from 'test/integration/constants/view-gql-fields.constants';
import { type ViewFilterEntity } from 'src/engine/metadata-modules/view-filter/entities/view-filter.entity';
type CreateViewFilterOperationFactoryParams = {
gqlFields?: string;
data?: Partial<ViewFilterEntity>;
};
export const createViewFilterOperationFactory = ({
gqlFields = VIEW_FILTER_GQL_FIELDS,
data = {},
}: CreateViewFilterOperationFactoryParams = {}) => ({
query: gql`
mutation CreateCoreViewFilter($input: CreateViewFilterInput!) {
createCoreViewFilter(input: $input) {
${gqlFields}
}
}
`,
variables: {
input: data,
},
});
@@ -1,16 +0,0 @@
import gql from 'graphql-tag';
export const deleteViewFilterOperationFactory = ({
viewFilterId,
}: {
viewFilterId: string;
}) => ({
query: gql`
mutation DeleteCoreViewFilter($id: String!) {
deleteCoreViewFilter(id: $id)
}
`,
variables: {
id: viewFilterId,
},
});
@@ -1,16 +0,0 @@
import gql from 'graphql-tag';
export const destroyViewFilterOperationFactory = ({
viewFilterId,
}: {
viewFilterId: string;
}) => ({
query: gql`
mutation DestroyCoreViewFilter($id: String!) {
destroyCoreViewFilter(id: $id)
}
`,
variables: {
id: viewFilterId,
},
});
@@ -1,21 +0,0 @@
import gql from 'graphql-tag';
import { VIEW_FILTER_GQL_FIELDS } from 'test/integration/constants/view-gql-fields.constants';
export const findViewFiltersOperationFactory = ({
gqlFields = VIEW_FILTER_GQL_FIELDS,
viewId,
}: {
gqlFields?: string;
viewId: string;
}) => ({
query: gql`
query GetCoreViewFilters($viewId: String!) {
getCoreViewFilters(viewId: $viewId) {
${gqlFields}
}
}
`,
variables: {
viewId,
},
});
@@ -1,24 +0,0 @@
import gql from 'graphql-tag';
import { VIEW_FILTER_GQL_FIELDS } from 'test/integration/constants/view-gql-fields.constants';
export const updateViewFilterOperationFactory = ({
gqlFields = VIEW_FILTER_GQL_FIELDS,
viewFilterId,
data = {},
}: {
gqlFields?: string;
viewFilterId: string;
data?: object;
}) => ({
query: gql`
mutation UpdateCoreViewFilter($id: String!, $input: UpdateViewFilterInput!) {
updateCoreViewFilter(id: $id, input: $input) {
${gqlFields}
}
}
`,
variables: {
id: viewFilterId,
input: data,
},
});