Update Supabase clients and refactor codebase
Refactored several Supabase client functions and updated them to use generics. Also, the '@kit/supabase-config' package was removed from the project and all references were replaced accordingly. The project's dependencies were updated as well, including the Supabase package which was upgraded to the latest version.
This commit is contained in:
@@ -7,7 +7,6 @@ import { z } from 'zod';
|
||||
import { getProductPlanPair } from '@kit/billing';
|
||||
import { getBillingGatewayProvider } from '@kit/billing-gateway';
|
||||
import { getLogger } from '@kit/shared/logger';
|
||||
import { Database } from '@kit/supabase/database';
|
||||
import { requireUser } from '@kit/supabase/require-user';
|
||||
import { getSupabaseServerActionClient } from '@kit/supabase/server-actions-client';
|
||||
|
||||
@@ -15,6 +14,7 @@ import { PersonalAccountCheckoutSchema } from '~/(dashboard)/home/(user)/billing
|
||||
import appConfig from '~/config/app.config';
|
||||
import billingConfig from '~/config/billing.config';
|
||||
import pathsConfig from '~/config/paths.config';
|
||||
import { Database } from '~/lib/database.types';
|
||||
|
||||
export class UserBillingService {
|
||||
private readonly namespace = 'billing.personal-account';
|
||||
|
||||
@@ -7,13 +7,13 @@ import { z } from 'zod';
|
||||
import { LineItemSchema } from '@kit/billing';
|
||||
import { getBillingGatewayProvider } from '@kit/billing-gateway';
|
||||
import { getLogger } from '@kit/shared/logger';
|
||||
import { Database } from '@kit/supabase/database';
|
||||
import { requireUser } from '@kit/supabase/require-user';
|
||||
import { getSupabaseServerActionClient } from '@kit/supabase/server-actions-client';
|
||||
|
||||
import appConfig from '~/config/app.config';
|
||||
import billingConfig from '~/config/billing.config';
|
||||
import pathsConfig from '~/config/paths.config';
|
||||
import { Database } from '~/lib/database.types';
|
||||
|
||||
import { TeamCheckoutSchema } from '../../_lib/schema/team-billing.schema';
|
||||
|
||||
@@ -314,7 +314,7 @@ async function getBillingPermissionsForAccountId(
|
||||
* customer ID for the provided account ID
|
||||
*/
|
||||
async function getCustomerIdFromAccountId(
|
||||
client: ReturnType<typeof getSupabaseServerActionClient>,
|
||||
client: ReturnType<typeof getSupabaseServerActionClient<Database>>,
|
||||
accountId: string,
|
||||
) {
|
||||
const { data, error } = await client
|
||||
|
||||
@@ -2,7 +2,6 @@ import { SupabaseClient } from '@supabase/supabase-js';
|
||||
|
||||
import { PlusCircle } from 'lucide-react';
|
||||
|
||||
import { Database } from '@kit/supabase/database';
|
||||
import { getSupabaseServerComponentClient } from '@kit/supabase/server-component-client';
|
||||
import {
|
||||
AccountInvitationsTable,
|
||||
@@ -21,6 +20,7 @@ import { If } from '@kit/ui/if';
|
||||
import { PageBody, PageHeader } from '@kit/ui/page';
|
||||
import { Trans } from '@kit/ui/trans';
|
||||
|
||||
import { Database } from '~/lib/database.types';
|
||||
import { createI18nServerInstance } from '~/lib/i18n/i18n.server';
|
||||
import { withI18n } from '~/lib/i18n/with-i18n';
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ import { cache } from 'react';
|
||||
|
||||
import { getSupabaseServerComponentClient } from '@kit/supabase/server-component-client';
|
||||
|
||||
import { Database } from '~/lib/database.types';
|
||||
|
||||
export const loadUserWorkspace = cache(async () => {
|
||||
const client = getSupabaseServerComponentClient();
|
||||
|
||||
@@ -15,7 +17,7 @@ export const loadUserWorkspace = cache(async () => {
|
||||
});
|
||||
|
||||
async function loadUserAccounts(
|
||||
client: ReturnType<typeof getSupabaseServerComponentClient>,
|
||||
client: ReturnType<typeof getSupabaseServerComponentClient<Database>>,
|
||||
) {
|
||||
const { data: accounts, error } = await client
|
||||
.from('user_accounts')
|
||||
|
||||
Reference in New Issue
Block a user