mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
update: filtering.
This commit is contained in:
@@ -24,7 +24,7 @@ import type {
|
||||
} from '$lib/sdk/billing';
|
||||
import { isCloud } from '$lib/system';
|
||||
import { activeHeaderAlert, orgMissingPaymentMethod } from '$routes/(console)/store';
|
||||
import { AppwriteException, Query } from '@appwrite.io/console';
|
||||
import { AppwriteException, Query, Platform } from '@appwrite.io/console';
|
||||
import { derived, get, writable } from 'svelte/store';
|
||||
import { headerAlert } from './headerAlert';
|
||||
import { addNotification, notifications } from './notifications';
|
||||
@@ -558,7 +558,7 @@ export async function checkForMissingPaymentMethod() {
|
||||
Query.notEqual('billingPlan', BillingPlan.FREE),
|
||||
Query.isNull('paymentMethodId'),
|
||||
Query.isNull('backupPaymentMethodId'),
|
||||
Query.equal('platform', 'appwrite')
|
||||
Query.equal('platform', Platform.Appwrite)
|
||||
]);
|
||||
if (orgs?.total) {
|
||||
orgMissingPaymentMethod.set(orgs.teams[0]);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Query } from '@appwrite.io/console';
|
||||
import { Query, Platform } from '@appwrite.io/console';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { getLimit, getPage, pageToOffset } from '$lib/helpers/load';
|
||||
import { CARD_LIMIT } from '$lib/constants';
|
||||
@@ -14,7 +14,7 @@ export const load: PageLoad = async ({ url, route }) => {
|
||||
Query.offset(offset),
|
||||
Query.limit(limit),
|
||||
Query.orderDesc(''),
|
||||
Query.equal('platform', 'appwrite')
|
||||
Query.equal('platform', Platform.Appwrite)
|
||||
];
|
||||
|
||||
const organizations = !isCloud
|
||||
|
||||
+4
-2
@@ -1,14 +1,16 @@
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { isCloud } from '$lib/system';
|
||||
import { Query } from '@appwrite.io/console';
|
||||
import { Query, Platform } from '@appwrite.io/console';
|
||||
|
||||
export const load = async ({ parent, depends }) => {
|
||||
depends(Dependencies.DOMAINS);
|
||||
|
||||
const organizations = !isCloud
|
||||
? await sdk.forConsole.teams.list()
|
||||
: await sdk.forConsole.billing.listOrganization([Query.equal('platform', 'appwrite')]);
|
||||
: await sdk.forConsole.billing.listOrganization([
|
||||
Query.equal('platform', Platform.Appwrite)
|
||||
]);
|
||||
|
||||
const { domain } = await parent();
|
||||
return {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { redirect } from '@sveltejs/kit';
|
||||
import { base } from '$app/paths';
|
||||
import { isCloud } from '$lib/system';
|
||||
import { BillingPlan } from '$lib/constants';
|
||||
import { ID, type Models, Query } from '@appwrite.io/console';
|
||||
import { ID, type Models, Query, Platform } from '@appwrite.io/console';
|
||||
import type { OrganizationList } from '$lib/stores/organization';
|
||||
import { redirectTo } from '$routes/store';
|
||||
import type { PageLoad } from './$types';
|
||||
@@ -67,7 +67,7 @@ export const load: PageLoad = async ({ parent, url }) => {
|
||||
let organizations: Models.TeamList<Record<string, unknown>> | OrganizationList | undefined;
|
||||
if (isCloud) {
|
||||
organizations = await sdk.forConsole.billing.listOrganization([
|
||||
Query.equal('platform', 'appwrite')
|
||||
Query.equal('platform', Platform.Appwrite)
|
||||
]);
|
||||
} else {
|
||||
organizations = await sdk.forConsole.teams.list();
|
||||
@@ -91,7 +91,7 @@ export const load: PageLoad = async ({ parent, url }) => {
|
||||
|
||||
if (isCloud) {
|
||||
organizations = await sdk.forConsole.billing.listOrganization([
|
||||
Query.equal('platform', 'appwrite')
|
||||
Query.equal('platform', Platform.Appwrite)
|
||||
]);
|
||||
} else {
|
||||
organizations = await sdk.forConsole.teams.list();
|
||||
|
||||
@@ -3,7 +3,7 @@ import { redirect, error } from '@sveltejs/kit';
|
||||
import { base } from '$app/paths';
|
||||
import { isCloud } from '$lib/system';
|
||||
import { BillingPlan } from '$lib/constants';
|
||||
import { ID, type Models, Query } from '@appwrite.io/console';
|
||||
import { ID, type Models, Query, Platform } from '@appwrite.io/console';
|
||||
import type { OrganizationList } from '$lib/stores/organization';
|
||||
import { redirectTo } from '$routes/store';
|
||||
import type { PageLoad } from './$types';
|
||||
@@ -84,7 +84,7 @@ export const load: PageLoad = async ({ parent, url }) => {
|
||||
|
||||
if (isCloud) {
|
||||
organizations = await sdk.forConsole.billing.listOrganization([
|
||||
Query.equal('platform', 'appwrite')
|
||||
Query.equal('platform', Platform.Appwrite)
|
||||
]);
|
||||
} else {
|
||||
organizations = await sdk.forConsole.teams.list();
|
||||
@@ -109,7 +109,7 @@ export const load: PageLoad = async ({ parent, url }) => {
|
||||
// Refetch organizations after creation
|
||||
if (isCloud) {
|
||||
organizations = await sdk.forConsole.billing.listOrganization([
|
||||
Query.equal('platform', 'appwrite')
|
||||
Query.equal('platform', Platform.Appwrite)
|
||||
]);
|
||||
} else {
|
||||
organizations = await sdk.forConsole.teams.list();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BillingPlan } from '$lib/constants.js';
|
||||
import { sdk } from '$lib/stores/sdk.js';
|
||||
import { ID, type Models, Query } from '@appwrite.io/console';
|
||||
import { ID, type Models, Query, Platform } from '@appwrite.io/console';
|
||||
import { isCloud } from '$lib/system.js';
|
||||
import { error, redirect } from '@sveltejs/kit';
|
||||
import type { OrganizationList } from '$lib/stores/organization.js';
|
||||
@@ -40,7 +40,9 @@ export const load = async ({ parent, url, params }) => {
|
||||
let organizations: Models.TeamList<Record<string, unknown>> | OrganizationList | undefined;
|
||||
if (isCloud) {
|
||||
organizations = account?.$id
|
||||
? await sdk.forConsole.billing.listOrganization([Query.equal('platform', 'appwrite')])
|
||||
? await sdk.forConsole.billing.listOrganization([
|
||||
Query.equal('platform', Platform.Appwrite)
|
||||
])
|
||||
: undefined;
|
||||
} else {
|
||||
organizations = account?.$id ? await sdk.forConsole.teams.list() : undefined;
|
||||
|
||||
@@ -8,7 +8,7 @@ import type { LayoutLoad } from './$types';
|
||||
import { redirectTo } from './store';
|
||||
import { base, resolve } from '$app/paths';
|
||||
import type { Account } from '$lib/stores/user';
|
||||
import { type AppwriteException, Query } from '@appwrite.io/console';
|
||||
import { type AppwriteException, Query, Platform } from '@appwrite.io/console';
|
||||
import { isCloud, VARS } from '$lib/system';
|
||||
import { checkPricingRefAndRedirect } from '$lib/helpers/pricingRedirect';
|
||||
|
||||
@@ -43,7 +43,7 @@ export const load: LayoutLoad = async ({ depends, url, route }) => {
|
||||
organizations: !isCloud
|
||||
? await sdk.forConsole.teams.list()
|
||||
: await sdk.forConsole.billing.listOrganization([
|
||||
Query.equal('platform', 'appwrite')
|
||||
Query.equal('platform', Platform.Appwrite)
|
||||
])
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user