In this PR 1. Add integration tests for /metadata (master issue: https://github.com/twentyhq/twenty/issues/8719) 2. Fix relation deletion: index on "from" object was not deleted, impeding creation of a new relation between the same two objects A and B after relation between A and B was deleted
27 lines
613 B
TypeScript
27 lines
613 B
TypeScript
import gql from 'graphql-tag';
|
|
|
|
import { CreateRelationInput } from 'src/engine/metadata-modules/relation-metadata/dtos/create-relation.input';
|
|
|
|
type CreateOneRelationFactoryParams = {
|
|
gqlFields: string;
|
|
input?: {
|
|
relation: Omit<CreateRelationInput, 'workspaceId'>;
|
|
};
|
|
};
|
|
|
|
export const createOneRelationMetadataFactory = ({
|
|
gqlFields,
|
|
input,
|
|
}: CreateOneRelationFactoryParams) => ({
|
|
query: gql`
|
|
mutation CreateOneRelationMetadata($input: CreateOneRelationInput!) {
|
|
createOneRelation(input: $input) {
|
|
${gqlFields}
|
|
}
|
|
}
|
|
`,
|
|
variables: {
|
|
input,
|
|
},
|
|
});
|