mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: QA from steven isRelationshipToMany func
This commit is contained in:
1 parent
6ebb3d3c7a
commit
e80f228111
2 files changed
+6
-6
No files matched your search
+2
-3
@@ -103,6 +103,7 @@
|
||||
|
||||
$: getCollections(search).then((res) => (collectionList = res));
|
||||
$: collections = collectionList?.collections?.filter((n) => n.$id !== $collection.$id) ?? [];
|
||||
$: isToMany = isRelationshipToMany(data);
|
||||
|
||||
$: if (editing) {
|
||||
way = data.twoWay ? 'two' : 'one';
|
||||
@@ -235,9 +236,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<p class="u-text-center">
|
||||
<b data-private>{camelize($collection.name)}</b> has {isRelationshipToMany(data)
|
||||
? 'many'
|
||||
: 'one'}
|
||||
<b data-private>{camelize($collection.name)}</b> has {isToMany ? 'many' : 'one'}
|
||||
<b data-private>{data.key}</b>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
+4
-3
@@ -4,10 +4,11 @@ import type { Attributes } from '../../store';
|
||||
//TODO: remove `side` after SDK update
|
||||
export function isRelationshipToMany(attribute: Models.AttributeRelationship & { side: string }) {
|
||||
if (!attribute) return false;
|
||||
if (attribute?.side === 'parent') {
|
||||
return !['oneToOne', 'manyToOne'].includes(attribute?.relationType);
|
||||
} else {
|
||||
if (!attribute?.relationType) return false;
|
||||
if (attribute?.side === 'child') {
|
||||
return !['oneToOne', 'oneToMany'].includes(attribute?.relationType);
|
||||
} else {
|
||||
return !['oneToOne', 'manyToOne'].includes(attribute?.relationType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user