Refactor billing service and enhance account APIs

This commit includes renaming and refactoring of some billing services for clarification and coherence. It also improves account APIs in team-accounts and accounts packages by having added `getAccount` and `getTeamAccount` methods, allowing retrieval of account details via slug and id. Changes also include type modifications in `getSupabaseServerActionClient` function for better flexibility and precision.
This commit is contained in:
giancarlo
2024-05-12 14:05:08 +07:00
parent f22c9817bd
commit 7ada6b53c6
7 changed files with 50 additions and 11 deletions

View File

@@ -10,6 +10,25 @@ import { Database } from '@kit/supabase/database';
class AccountsApi {
constructor(private readonly client: SupabaseClient<Database>) {}
/**
* @name getAccount
* @description Get the account data for the given ID.
* @param id
*/
async getAccount(id: string) {
const { data, error } = await this.client
.from('accounts')
.select('*')
.eq('id', id)
.single();
if (error) {
throw error;
}
return data;
}
/**
* @name getAccountWorkspace
* @description Get the account workspace data.