From 419c5ced70d9f25cc037132b2c6737976b59af5f Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Thu, 9 Nov 2023 15:31:20 +0000 Subject: [PATCH 1/3] fix issue with relationship selection --- .../Datasources/CreateEditRelationship.svelte | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/builder/src/components/backend/Datasources/CreateEditRelationship.svelte b/packages/builder/src/components/backend/Datasources/CreateEditRelationship.svelte index f6621c1508..abdc95a6da 100644 --- a/packages/builder/src/components/backend/Datasources/CreateEditRelationship.svelte +++ b/packages/builder/src/components/backend/Datasources/CreateEditRelationship.svelte @@ -33,6 +33,10 @@ part1: PrettyRelationshipDefinitions.MANY, part2: PrettyRelationshipDefinitions.ONE, }, + [RelationshipType.MANY_TO_ONE]: { + part1: PrettyRelationshipDefinitions.ONE, + part2: PrettyRelationshipDefinitions.MANY, + }, } let relationshipOpts1 = Object.values(PrettyRelationshipDefinitions) let relationshipOpts2 = Object.values(PrettyRelationshipDefinitions) @@ -58,7 +62,7 @@ let fromPrimary, fromForeign, fromColumn, toColumn let throughId, throughToKey, throughFromKey - let isManyToMany, isManyToOne, relationshipType + let relationshipType let hasValidated = false $: fromId = null @@ -85,8 +89,10 @@ $: valid = getErrorCount(errors) === 0 && allRequiredAttributesSet(relationshipType) $: isManyToMany = relationshipType === RelationshipType.MANY_TO_MANY - $: isManyToOne = relationshipType === RelationshipType.MANY_TO_ONE - + $: isManyToOne = + relationshipType === RelationshipType.MANY_TO_ONE || + relationshipType === RelationshipType.ONE_TO_MANY + $: console.log(relationshipType) function getTable(id) { return plusTables.find(table => table._id === id) } From 77f0eebdfdb5afec83bf1fc75d49b19209c81ed0 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 9 Nov 2023 17:30:40 +0000 Subject: [PATCH 2/3] Removing stray console.log. --- .../components/backend/Datasources/CreateEditRelationship.svelte | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/builder/src/components/backend/Datasources/CreateEditRelationship.svelte b/packages/builder/src/components/backend/Datasources/CreateEditRelationship.svelte index abdc95a6da..3f2253c754 100644 --- a/packages/builder/src/components/backend/Datasources/CreateEditRelationship.svelte +++ b/packages/builder/src/components/backend/Datasources/CreateEditRelationship.svelte @@ -92,7 +92,6 @@ $: isManyToOne = relationshipType === RelationshipType.MANY_TO_ONE || relationshipType === RelationshipType.ONE_TO_MANY - $: console.log(relationshipType) function getTable(id) { return plusTables.find(table => table._id === id) } From 6282582bb0426b7e473db02287df4b21da9e68a9 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 10 Nov 2023 11:02:50 +0000 Subject: [PATCH 3/3] PR comments. --- .../backend/Datasources/CreateEditRelationship.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/components/backend/Datasources/CreateEditRelationship.svelte b/packages/builder/src/components/backend/Datasources/CreateEditRelationship.svelte index 3f2253c754..af678a88ba 100644 --- a/packages/builder/src/components/backend/Datasources/CreateEditRelationship.svelte +++ b/packages/builder/src/components/backend/Datasources/CreateEditRelationship.svelte @@ -33,7 +33,7 @@ part1: PrettyRelationshipDefinitions.MANY, part2: PrettyRelationshipDefinitions.ONE, }, - [RelationshipType.MANY_TO_ONE]: { + [RelationshipType.ONE_TO_MANY]: { part1: PrettyRelationshipDefinitions.ONE, part2: PrettyRelationshipDefinitions.MANY, },