[CoreViewField BREAKING_CHANGES] Refactor view field service v2 and resolver (#14396)
## Introduction ### Twenty-sever Standardizing resolver input and transpilation models + return type on destroy and delete ~~Finally~~ Did plug everything under a feature flag and add coverage Next will do same for the view resolver and service v2 ### Twenty-front Refactored view field service in order to use codegenerated strictly typed mutations and adapt to new api contract
This commit is contained in:
+8
-3
@@ -1,16 +1,21 @@
|
||||
import gql from 'graphql-tag';
|
||||
import { VIEW_FIELD_GQL_FIELDS } from 'test/integration/constants/view-gql-fields.constants';
|
||||
|
||||
export const deleteViewFieldOperationFactory = ({
|
||||
viewFieldId,
|
||||
gqlFields = VIEW_FIELD_GQL_FIELDS,
|
||||
}: {
|
||||
gqlFields?: string;
|
||||
viewFieldId: string;
|
||||
}) => ({
|
||||
query: gql`
|
||||
mutation DeleteCoreViewField($id: String!) {
|
||||
deleteCoreViewField(id: $id)
|
||||
mutation DeleteCoreViewField($input: DeleteViewFieldInput!) {
|
||||
deleteCoreViewField(input: $input) {
|
||||
${gqlFields}
|
||||
}
|
||||
}
|
||||
`,
|
||||
variables: {
|
||||
id: viewFieldId,
|
||||
input: { id: viewFieldId },
|
||||
},
|
||||
});
|
||||
|
||||
+8
-3
@@ -1,16 +1,21 @@
|
||||
import gql from 'graphql-tag';
|
||||
import { VIEW_FIELD_GQL_FIELDS } from 'test/integration/constants/view-gql-fields.constants';
|
||||
|
||||
export const destroyViewFieldOperationFactory = ({
|
||||
viewFieldId,
|
||||
gqlFields = VIEW_FIELD_GQL_FIELDS,
|
||||
}: {
|
||||
gqlFields?: string;
|
||||
viewFieldId: string;
|
||||
}) => ({
|
||||
query: gql`
|
||||
mutation DestroyCoreViewField($id: String!) {
|
||||
destroyCoreViewField(id: $id)
|
||||
mutation DestroyCoreViewField($input: DestroyViewFieldInput!) {
|
||||
destroyCoreViewField(input: $input){
|
||||
${gqlFields}
|
||||
}
|
||||
}
|
||||
`,
|
||||
variables: {
|
||||
id: viewFieldId,
|
||||
input: { id: viewFieldId },
|
||||
},
|
||||
});
|
||||
|
||||
+7
-8
@@ -1,24 +1,23 @@
|
||||
import gql from 'graphql-tag';
|
||||
import { VIEW_FIELD_GQL_FIELDS } from 'test/integration/constants/view-gql-fields.constants';
|
||||
|
||||
import { type UpdateViewFieldInput } from 'src/engine/core-modules/view/dtos/inputs/update-view-field.input';
|
||||
|
||||
export const updateViewFieldOperationFactory = ({
|
||||
gqlFields = VIEW_FIELD_GQL_FIELDS,
|
||||
viewFieldId,
|
||||
data = {},
|
||||
input,
|
||||
}: {
|
||||
gqlFields?: string;
|
||||
viewFieldId: string;
|
||||
data?: object;
|
||||
input: UpdateViewFieldInput;
|
||||
}) => ({
|
||||
query: gql`
|
||||
mutation UpdateCoreViewField($id: String!, $input: UpdateViewFieldInput!) {
|
||||
updateCoreViewField(id: $id, input: $input) {
|
||||
mutation UpdateCoreViewField($input: UpdateViewFieldInput!) {
|
||||
updateCoreViewField(input: $input) {
|
||||
${gqlFields}
|
||||
}
|
||||
}
|
||||
`,
|
||||
variables: {
|
||||
id: viewFieldId,
|
||||
input: data,
|
||||
input,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { type UpdateViewFieldInput } from 'src/engine/core-modules/view/dtos/inputs/update-view-field.input';
|
||||
import { type ViewFieldEntity } from 'src/engine/core-modules/view/entities/view-field.entity';
|
||||
import { type ViewFilterGroupEntity } from 'src/engine/core-modules/view/entities/view-filter-group.entity';
|
||||
import { type ViewFilterEntity } from 'src/engine/core-modules/view/entities/view-filter.entity';
|
||||
@@ -40,7 +41,7 @@ export const createViewFieldData = (
|
||||
});
|
||||
|
||||
export const updateViewFieldData = (
|
||||
overrides: Partial<ViewFieldEntity> = {},
|
||||
overrides: Partial<UpdateViewFieldInput['update']> = {},
|
||||
) => ({
|
||||
position: 5,
|
||||
isVisible: false,
|
||||
|
||||
Reference in New Issue
Block a user