Connect logic in Workspace Entity Manager (#13078)
Large PR, sorry for that. Don't hesitate to reach me to have full context (env. 500lines for integration and unit tests) - Add connect logic in Workspace Entity Manager - Update QueryDeepPartialEntity type to enable dev to use connect - Add integration test on createOne / createMany - Add unit test to cover main utils - Remove feature flag on connect closes https://github.com/twentyhq/core-team-issues/issues/1148 closes https://github.com/twentyhq/core-team-issues/issues/1147
This commit is contained in:
+2
-8
@@ -47,13 +47,11 @@ export const generateFields = <
|
||||
kind,
|
||||
options,
|
||||
typeFactory,
|
||||
isRelationConnectEnabled = false,
|
||||
}: {
|
||||
objectMetadata: ObjectMetadataInterface;
|
||||
kind: T;
|
||||
options: WorkspaceBuildSchemaOptions;
|
||||
typeFactory: TypeFactory<T>;
|
||||
isRelationConnectEnabled?: boolean;
|
||||
}): T extends InputTypeDefinitionKind
|
||||
? GraphQLInputFieldConfigMap
|
||||
: // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
@@ -80,7 +78,6 @@ export const generateFields = <
|
||||
kind,
|
||||
options,
|
||||
typeFactory,
|
||||
isRelationConnectEnabled,
|
||||
});
|
||||
} else {
|
||||
generatedField = generateField({
|
||||
@@ -168,7 +165,6 @@ const generateRelationField = <
|
||||
kind,
|
||||
options,
|
||||
typeFactory,
|
||||
isRelationConnectEnabled,
|
||||
}: {
|
||||
fieldMetadata: FieldMetadataInterface<
|
||||
FieldMetadataType.RELATION | FieldMetadataType.MORPH_RELATION
|
||||
@@ -176,7 +172,6 @@ const generateRelationField = <
|
||||
kind: T;
|
||||
options: WorkspaceBuildSchemaOptions;
|
||||
typeFactory: TypeFactory<T>;
|
||||
isRelationConnectEnabled: boolean;
|
||||
}) => {
|
||||
const relationField = {};
|
||||
|
||||
@@ -208,11 +203,10 @@ const generateRelationField = <
|
||||
};
|
||||
|
||||
if (
|
||||
[InputTypeDefinitionKind.Create, InputTypeDefinitionKind.Update].includes(
|
||||
[InputTypeDefinitionKind.Create].includes(
|
||||
kind as InputTypeDefinitionKind,
|
||||
) &&
|
||||
isDefined(fieldMetadata.relationTargetObjectMetadataId) &&
|
||||
isRelationConnectEnabled
|
||||
isDefined(fieldMetadata.relationTargetObjectMetadataId)
|
||||
) {
|
||||
type = typeFactory.create(
|
||||
formatRelationConnectInputTarget(
|
||||
|
||||
Reference in New Issue
Block a user