Refactor billing imports, reorganize package scripts and improve action structure
Deleted unnecessary schema files and reorganized their imports into more logical order. Modified the package script structure to align more accurately with standard conventions. Also refactored the team-billing.service file to improve action structure, making it easier to understand and edit. Furthermore, upgraded various dependencies, reflecting their new versions in the lockfile.
This commit is contained in:
@@ -2,25 +2,26 @@
|
||||
|
||||
import { redirect } from 'next/navigation';
|
||||
|
||||
import { z } from 'zod';
|
||||
|
||||
import { enhanceAction } from '@kit/next/actions';
|
||||
import { getSupabaseServerActionClient } from '@kit/supabase/server-actions-client';
|
||||
|
||||
import { PersonalAccountCheckoutSchema } from './_lib/schema/personal-account-checkout.schema';
|
||||
import { UserBillingService } from './_lib/server/user-billing.service';
|
||||
|
||||
/**
|
||||
* @name createPersonalAccountCheckoutSession
|
||||
* @description Creates a checkout session for a personal account.
|
||||
*/
|
||||
export async function createPersonalAccountCheckoutSession(
|
||||
params: z.infer<typeof PersonalAccountCheckoutSchema>,
|
||||
) {
|
||||
// parse the parameters
|
||||
const data = PersonalAccountCheckoutSchema.parse(params);
|
||||
const service = new UserBillingService(getSupabaseServerActionClient());
|
||||
export const createPersonalAccountCheckoutSession = enhanceAction(
|
||||
async function (data) {
|
||||
const service = new UserBillingService(getSupabaseServerActionClient());
|
||||
|
||||
return await service.createCheckoutSession(data);
|
||||
}
|
||||
return await service.createCheckoutSession(data);
|
||||
},
|
||||
{
|
||||
schema: PersonalAccountCheckoutSchema,
|
||||
},
|
||||
);
|
||||
|
||||
/**
|
||||
* @description Creates a billing Portal session for a personal account
|
||||
|
||||
Reference in New Issue
Block a user