Refactor Supabase type imports for improved clarity

Replaced specific object paths with generic type helpers across several files to enhance readability and maintainability. This change standardizes the import patterns and type definitions for database tables and enums.
This commit is contained in:
gbuomprisco
2024-08-16 12:48:29 +02:00
parent 475325d5eb
commit 089fd37ece
11 changed files with 33 additions and 34 deletions

View File

@@ -6,7 +6,7 @@ import {
import { BillingConfig, BillingWebhookHandlerService } from '@kit/billing';
import { getLogger } from '@kit/shared/logger';
import { Database } from '@kit/supabase/database';
import { Database, Enums } from '@kit/supabase/database';
import { getLemonSqueezyEnv } from '../schema/lemon-squeezy-server-env.schema';
import { OrderWebhook } from '../types/order-webhook';
@@ -24,6 +24,8 @@ type UpsertSubscriptionParams =
type UpsertOrderParams =
Database['public']['Functions']['upsert_order']['Args'];
type BillingProvider = Enums<'billing_provider'>;
interface LineItem {
id: string;
quantity: number;
@@ -42,8 +44,7 @@ type OrderStatus = 'pending' | 'failed' | 'paid' | 'refunded';
export class LemonSqueezyWebhookHandlerService
implements BillingWebhookHandlerService
{
private readonly provider: Database['public']['Enums']['billing_provider'] =
'lemon-squeezy';
private readonly provider: BillingProvider = 'lemon-squeezy';
private readonly namespace = 'billing.lemon-squeezy';