Skip to content

Commit 5be9825

Browse files
authored
Merge pull request #392 from appwrite/fix-relations-descriptions
Fix: relations message
2 parents cfb6a45 + 872fb2e commit 5be9825

1 file changed

Lines changed: 20 additions & 17 deletions

File tree

  • src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes

src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/relationship.svelte

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
import arrowTwo from './arrow-two.svg';
4545
import { camelize } from '$lib/helpers/string';
4646
import { SelectSearchItem } from '$lib/elements';
47-
import { isRelationshipToMany } from '../document-[document]/attributes/store';
4847
4948
// Props
5049
export let data: Models.AttributeRelationship;
@@ -102,7 +101,6 @@
102101
103102
$: getCollections(search).then((res) => (collectionList = res));
104103
$: collections = collectionList?.collections?.filter((n) => n.$id !== $collection.$id) ?? [];
105-
$: isToMany = isRelationshipToMany(data);
106104
107105
$: if (editing) {
108106
way = data.twoWay ? 'two' : 'one';
@@ -234,21 +232,26 @@
234232
<span>{data.key}</span>
235233
</div>
236234
</div>
237-
<div>
238-
<p class="u-text-center">
239-
<b data-private>{camelize($collection.name)}</b> can contain {data.relationType &&
240-
!['oneToOne', 'oneToMany'].includes(data.relationType)
241-
? 'many'
242-
: 'one'}
243-
<b data-private>{data.key}</b>
244-
</p>
245-
<p class="u-text-center">
246-
<b data-private>{camelize($collection.name)}</b> can belong to {isToMany
247-
? 'many'
248-
: 'one'}
249-
<b data-private>{data.key}</b>
250-
</p>
251-
</div>
235+
{#if data.relationType}
236+
<div>
237+
<p class="u-text-center">
238+
<b data-private>{camelize($collection.name)}</b> can contain {[
239+
'oneToOne',
240+
'manyToOne'
241+
].includes(data.relationType)
242+
? 'one'
243+
: 'many'}
244+
<b data-private>{camelize(data.key)}</b>
245+
</p>
246+
<p class="u-text-center">
247+
<b data-private>{camelize(data.key)}</b>
248+
can belong to {['oneToOne', 'oneToMany'].includes(data.relationType)
249+
? 'one'
250+
: 'many'}
251+
<b data-private>{camelize($collection.name)}</b>
252+
</p>
253+
</div>
254+
{/if}
252255
</div>
253256
<InputSelect
254257
id="deleting"

0 commit comments

Comments
 (0)