feat: create email template for TTO reservation confirmation

feat: implement order notifications service with TTO reservation confirmation handling

feat: create migration for TTO booking email webhook trigger
This commit is contained in:
Danel Kungla
2025-09-30 16:05:43 +03:00
parent 4003284f3a
commit 72f6f2b716
56 changed files with 3692 additions and 294 deletions

View File

@@ -43,12 +43,17 @@ export class AccountBalanceService {
offset?: number;
entryType?: string;
includeInactive?: boolean;
} = {}
} = {},
): Promise<{
entries: AccountBalanceEntry[];
total: number;
}> {
const { limit = 50, offset = 0, entryType, includeInactive = false } = options;
const {
limit = 50,
offset = 0,
entryType,
includeInactive = false,
} = options;
let query = this.supabase
.schema('medreport')
@@ -105,7 +110,8 @@ export class AccountBalanceService {
console.error('Error getting expiring balance:', expiringError);
}
const expiringSoon = expiringData?.reduce((sum, entry) => sum + (entry.amount || 0), 0) || 0;
const expiringSoon =
expiringData?.reduce((sum, entry) => sum + (entry.amount || 0), 0) || 0;
return {
totalBalance: balance,
@@ -116,12 +122,13 @@ export class AccountBalanceService {
async processPeriodicBenefitDistributions(): Promise<void> {
console.info('Processing periodic benefit distributions...');
const { error } = await this.supabase.schema('medreport').rpc('process_periodic_benefit_distributions');
const { error } = await this.supabase
.schema('medreport')
.rpc('process_periodic_benefit_distributions');
if (error) {
console.error('Error processing periodic benefit distributions:', error);
throw new Error('Failed to process periodic benefit distributions');
}
console.info('Periodic benefit distributions processed successfully');
}
}