add health benefit form
fix super admin
This commit is contained in:
@@ -2,6 +2,8 @@ import { SupabaseClient } from '@supabase/supabase-js';
|
||||
|
||||
import { Database } from '@kit/supabase/database';
|
||||
|
||||
import { UpdateHealthBenefitData } from './types';
|
||||
|
||||
/**
|
||||
* Class representing an API for interacting with team accounts.
|
||||
* @constructor
|
||||
@@ -254,6 +256,45 @@ export class TeamAccountsApi {
|
||||
|
||||
return invitation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name updateHealthBenefit
|
||||
* @description Update health benefits for the team account
|
||||
*/
|
||||
async updateHealthBenefit(data: UpdateHealthBenefitData) {
|
||||
const { error } = await this.client
|
||||
.schema('medreport')
|
||||
.from('company_params')
|
||||
.update({
|
||||
benefit_occurance: data.occurance,
|
||||
benefit_amount: data.amount,
|
||||
updated_at: new Date().toISOString(),
|
||||
})
|
||||
.eq('account_id', data.accountId);
|
||||
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @name getTeamAccountParams
|
||||
* @description Get health benefits for the team account
|
||||
*/
|
||||
async getTeamAccountParams(accountId: string) {
|
||||
const { data, error } = await this.client
|
||||
.schema('medreport')
|
||||
.from('company_params')
|
||||
.select('*')
|
||||
.eq('account_id', accountId)
|
||||
.single();
|
||||
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
export function createTeamAccountsApi(client: SupabaseClient<Database>) {
|
||||
|
||||
Reference in New Issue
Block a user