mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: some types
This commit is contained in:
1 parent
4b34ceebf4
commit
e5fa833575
5 files changed
+15
-12
No files matched your search
+2
-1
@@ -13,6 +13,7 @@
|
||||
} from '$lib/elements/table';
|
||||
import { Container } from '$lib/layout';
|
||||
import Create from '../createAttribute.svelte';
|
||||
import { isRelationship } from '../document-[document]/attributes/realtionship';
|
||||
import CreateIndex from '../indexes/createIndex.svelte';
|
||||
import { attributes, type Attributes } from '../store';
|
||||
import CreateAttributeDropdown from './createAttributeDropdown.svelte';
|
||||
@@ -54,7 +55,7 @@
|
||||
<div class="u-flex u-main-space-between u-cross-center">
|
||||
<div class="u-flex u-cross-center u-gap-16">
|
||||
<div class="avatar is-size-small u-color-text-gray">
|
||||
{#if option.icon === 'relationship'}
|
||||
{#if isRelationship(attribute)}
|
||||
<span
|
||||
class={`icon-${
|
||||
attribute?.twoWay
|
||||
|
||||
+1
-5
@@ -10,7 +10,7 @@
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { isRelationship } from '../document-[document]/attributes/realtionship';
|
||||
|
||||
export let showDelete = false;
|
||||
export let selectedAttribute: Attributes;
|
||||
@@ -42,10 +42,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
function isRelationship(attr: Attributes): attr is Models.AttributeRelationship {
|
||||
return attr?.type === 'relationship';
|
||||
}
|
||||
|
||||
$: isDeleteBtnDisabled =
|
||||
isRelationship(selectedAttribute) && selectedAttribute?.twoWay && !checked;
|
||||
</script>
|
||||
|
||||
+6
@@ -1,4 +1,5 @@
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import type { Attributes } from '../../store';
|
||||
|
||||
export function isRelationshipToMany(attribute: Models.AttributeRelationship) {
|
||||
if (!attribute) return false;
|
||||
@@ -9,3 +10,8 @@ export function isRelationshipToMany(attribute: Models.AttributeRelationship) {
|
||||
return !['oneToOne', 'oneToMany'].includes(relationType);
|
||||
}
|
||||
}
|
||||
|
||||
export function isRelationship(attribute: Attributes): attribute is Models.AttributeRelationship {
|
||||
if (!attribute) return false;
|
||||
return attribute?.type === 'relationship';
|
||||
}
|
||||
+5
-1
@@ -17,6 +17,8 @@
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { attributes, collection } from '../store';
|
||||
import { isRelationship } from './attributes/realtionship';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
|
||||
export let showDelete = false;
|
||||
const databaseId = $page.params.database;
|
||||
@@ -53,7 +55,9 @@
|
||||
'restrict' = 'Document can not be deleted'
|
||||
}
|
||||
|
||||
$: relAttributes = [$attributes?.find((attribute) => attribute.type === 'relationship')];
|
||||
$: relAttributes = [
|
||||
$attributes?.find((attribute) => isRelationship(attribute))
|
||||
] as Models.AttributeRelationship[];
|
||||
</script>
|
||||
|
||||
<Modal
|
||||
|
||||
+1
-5
@@ -19,7 +19,7 @@
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { onMount } from 'svelte';
|
||||
import type { PageData } from './$types';
|
||||
import type Attribute from './document-[document]/attribute.svelte';
|
||||
import { isRelationship } from './document-[document]/attributes/realtionship';
|
||||
import RelationshipsModal from './relationshipsModal.svelte';
|
||||
import { attributes, collection, columns } from './store';
|
||||
|
||||
@@ -73,10 +73,6 @@
|
||||
};
|
||||
}
|
||||
|
||||
function isRelationship(attr: Partial<Attribute>): attr is Models.AttributeRelationship {
|
||||
return attr?.type === 'relationship';
|
||||
}
|
||||
|
||||
$: selected = preferences.getCustomCollectionColumns($page.params.collection);
|
||||
|
||||
$: columns.set(
|
||||
|
||||
Reference in new issue
Block a user