misc: cleanup.

This commit is contained in:
Darshan
2025-03-16 16:55:22 +05:30
parent b39d689297
commit aeaab5d005
2 changed files with 6 additions and 16 deletions
@@ -4,7 +4,6 @@
import { sdk } from '$lib/stores/sdk';
import type { Models } from '@appwrite.io/console';
// TODO: @itznotabug extract const $page = get(page);
export async function submitFloat(
databaseId: string,
collectionId: string,
@@ -2,7 +2,7 @@
import { get } from 'svelte/store';
import { page } from '$app/stores';
import { sdk } from '$lib/stores/sdk';
import { ID, Query, type Models, RelationshipType, RelationMutate } from '@appwrite.io/console';
import { ID, type Models, Query, RelationMutate, RelationshipType } from '@appwrite.io/console';
export async function submitRelationship(
databaseId: string,
@@ -16,7 +16,7 @@
if (!isValueOfStringEnum(RelationMutate, data.onDelete)) {
throw new Error(`Invalid on delete: ${data.onDelete}`);
}
// TODO: @itznotabug extract const $page = get(page);
const $page = get(page);
await sdk
.forProject($page.params.region, $page.params.project)
@@ -41,7 +41,6 @@
if (!isValueOfStringEnum(RelationMutate, data.onDelete)) {
throw new Error(`Invalid on delete: ${data.onDelete}`);
}
// TODO: @itznotabug extract const $page = get(page);
const $page = get(page);
await sdk
@@ -93,18 +92,10 @@
// Lifecycle hooks
async function getCollections(search: string = null) {
if (search) {
// TODO: @itznotabug inline `collections`.
const collections = await sdk
.forProject($page.params.region, $page.params.project)
.databases.listCollections(databaseId, [Query.orderDesc('')], search);
return collections;
} else {
const collections = await sdk
.forProject($page.params.region, $page.params.project)
.databases.listCollections(databaseId, [Query.limit(100)]);
return collections;
}
const queries = search ? [Query.orderDesc('')] : [Query.limit(100)];
return sdk
.forProject($page.params.region, $page.params.project)
.databases.listCollections(databaseId, queries, search);
}
function updateKeyName() {