mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: outdated sdk call
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import { page } from '$app/stores';
|
||||
import { derived, get } from 'svelte/store';
|
||||
import { derived } from 'svelte/store';
|
||||
import type { Models } from '@aw-labs/appwrite-console';
|
||||
import { sdkForConsole } from './sdk';
|
||||
import { sdk } from './sdk';
|
||||
import { cachedStore } from '$lib/helpers/cache';
|
||||
import { browser } from '$app/environment';
|
||||
|
||||
export const user = derived(
|
||||
page,
|
||||
@@ -18,11 +17,11 @@ export const prefs = cachedStore<
|
||||
}
|
||||
>('prefs', (store) => ({
|
||||
load: async () => {
|
||||
const prefs = await sdkForConsole.account.getPrefs();
|
||||
const prefs = await sdk.forConsole.account.getPrefs();
|
||||
store.set(prefs);
|
||||
},
|
||||
updatePrefs: async (prefs: Models.Preferences) => {
|
||||
await sdkForConsole.account.updatePrefs(prefs);
|
||||
await sdk.forConsole.account.updatePrefs(prefs);
|
||||
store.set(prefs);
|
||||
}
|
||||
}));
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
|
||||
data: Partial<Models.AttributeBoolean>
|
||||
) {
|
||||
await sdkForProject.databases.createBooleanAttribute(
|
||||
await sdk.forProject.databases.createBooleanAttribute(
|
||||
databaseId,
|
||||
collectionId,
|
||||
data.key,
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
collectionId: string,
|
||||
data: Partial<Models.AttributeDatetime>
|
||||
) {
|
||||
await sdkForProject.databases.createDatetimeAttribute(
|
||||
await sdk.forProject.databases.createDatetimeAttribute(
|
||||
databaseId,
|
||||
collectionId,
|
||||
data.key,
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
collectionId: string,
|
||||
data: Partial<Models.AttributeEmail>
|
||||
) {
|
||||
await sdkForProject.databases.createEmailAttribute(
|
||||
await sdk.forProject.databases.createEmailAttribute(
|
||||
databaseId,
|
||||
collectionId,
|
||||
data.key,
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
collectionId: string,
|
||||
data: Partial<Models.AttributeEnum>
|
||||
) {
|
||||
await sdkForProject.databases.createEnumAttribute(
|
||||
await sdk.forProject.databases.createEnumAttribute(
|
||||
databaseId,
|
||||
collectionId,
|
||||
data.key,
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
collectionId: string,
|
||||
data: Partial<Models.AttributeFloat>
|
||||
) {
|
||||
await sdkForProject.databases.createFloatAttribute(
|
||||
await sdk.forProject.databases.createFloatAttribute(
|
||||
databaseId,
|
||||
collectionId,
|
||||
data.key,
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
collectionId: string,
|
||||
data: Partial<Models.AttributeInteger>
|
||||
) {
|
||||
await sdkForProject.databases.createIntegerAttribute(
|
||||
await sdk.forProject.databases.createIntegerAttribute(
|
||||
databaseId,
|
||||
collectionId,
|
||||
data.key,
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
collectionId: string,
|
||||
data: Partial<Models.AttributeIp>
|
||||
) {
|
||||
await sdkForProject.databases.createIpAttribute(
|
||||
await sdk.forProject.databases.createIpAttribute(
|
||||
databaseId,
|
||||
collectionId,
|
||||
data.key,
|
||||
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
<script context="module" lang="ts">
|
||||
import { Query, type Models } from '@aw-labs/appwrite-console';
|
||||
import { sdkForProject } from '$lib/stores/sdk';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
|
||||
export async function submitRelationship(
|
||||
databaseId: string,
|
||||
@@ -8,7 +8,7 @@
|
||||
key: string,
|
||||
data: Partial<Models.AttributeString>
|
||||
) {
|
||||
await sdkForProject.databases.createStringAttribute(
|
||||
await sdk.forProject.databases.createStringAttribute(
|
||||
databaseId,
|
||||
collectionId,
|
||||
key,
|
||||
@@ -24,7 +24,7 @@
|
||||
collectionId: string,
|
||||
data: Partial<Models.AttributeString>
|
||||
) {
|
||||
await sdkForProject.databases.createStringAttribute(
|
||||
await sdk.forProject.databases.createStringAttribute(
|
||||
databaseId,
|
||||
collectionId,
|
||||
data.key,
|
||||
@@ -90,14 +90,14 @@
|
||||
// Lifecycle hooks
|
||||
async function getCollections(search: string = null) {
|
||||
if (search) {
|
||||
const collections = await sdkForProject.databases.listCollections(
|
||||
const collections = await sdk.forProject.databases.listCollections(
|
||||
databaseId,
|
||||
[Query.orderDesc('$createdAt')],
|
||||
search
|
||||
);
|
||||
return collections;
|
||||
} else {
|
||||
const collections = await sdkForProject.databases.listCollections(databaseId);
|
||||
const collections = await sdk.forProject.databases.listCollections(databaseId);
|
||||
return collections;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
collectionId: string,
|
||||
data: Partial<Models.AttributeString>
|
||||
) {
|
||||
await sdkForProject.databases.createStringAttribute(
|
||||
await sdk.forProject.databases.createStringAttribute(
|
||||
databaseId,
|
||||
collectionId,
|
||||
data.key,
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
collectionId: string,
|
||||
data: Partial<Models.AttributeUrl>
|
||||
) {
|
||||
await sdkForProject.databases.createUrlAttribute(
|
||||
await sdk.forProject.databases.createUrlAttribute(
|
||||
databaseId,
|
||||
collectionId,
|
||||
data.key,
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { Button, InputSelectSearch } from '$lib/elements/forms';
|
||||
import { sdkForProject } from '$lib/stores/sdk';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { Query, type Models } from '@aw-labs/appwrite-console';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
@@ -20,14 +20,14 @@
|
||||
|
||||
async function getCollections(search: string = null) {
|
||||
if (search) {
|
||||
const collections = await sdkForProject.databases.listCollections(
|
||||
const collections = await sdk.forProject.databases.listCollections(
|
||||
attribute.related,
|
||||
[Query.orderDesc('$createdAt')],
|
||||
search
|
||||
);
|
||||
return collections;
|
||||
} else {
|
||||
const collections = await sdkForProject.databases.listCollections(attribute.related);
|
||||
const collections = await sdk.forProject.databases.listCollections(attribute.related);
|
||||
return collections;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { CardGrid, Heading } from '$lib/components';
|
||||
import { page } from '$app/stores';
|
||||
import { sdkForProject } from '$lib/stores/sdk';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { writable } from 'svelte/store';
|
||||
import type { Models } from '@aw-labs/appwrite-console';
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
async function updateData() {
|
||||
try {
|
||||
await sdkForProject.databases.updateDocument(
|
||||
await sdk.forProject.databases.updateDocument(
|
||||
databaseId,
|
||||
collectionId,
|
||||
documentId,
|
||||
|
||||
Reference in New Issue
Block a user