add benefit eligibility setting to HR members

This commit is contained in:
Danel Kungla
2025-10-03 15:33:38 +03:00
parent 419bcc11cb
commit 47e8bd873c
10 changed files with 287 additions and 19 deletions

View File

@@ -120,6 +120,22 @@ export class AccountBalanceService {
};
}
async upsertHealthBenefitsBySchedule(
benefitDistributionScheduleId: string,
): Promise<void> {
console.info('Updating health benefits...');
const { error } = await this.supabase
.schema('medreport')
.rpc('upsert_health_benefits', {
p_benefit_distribution_schedule_id: benefitDistributionScheduleId,
});
if (error) {
console.error('Error Updating health benefits.', error);
throw new Error('Failed Updating health benefits.');
}
console.info('Updating health benefits successfully');
}
async processPeriodicBenefitDistributions(): Promise<void> {
console.info('Processing periodic benefit distributions...');
const { error } = await this.supabase