harden media

This commit is contained in:
2025-12-31 15:39:28 +01:00
parent 92226800df
commit 8260bf7baf
413 changed files with 8361 additions and 1544 deletions

View File

@@ -34,7 +34,7 @@ export class PaymentService {
async getPayments(leagueId?: string, payerId?: string): Promise<PaymentViewModel[]> {
const query = (leagueId || payerId) ? { ...(leagueId && { leagueId }), ...(payerId && { payerId }) } : undefined;
const dto = await this.apiClient.getPayments(query);
return dto.payments.map((payment: PaymentDTO) => new PaymentViewModel(payment));
return (dto?.payments || []).map((payment: PaymentDTO) => new PaymentViewModel(payment));
}
/**
@@ -43,7 +43,7 @@ export class PaymentService {
async getPayment(paymentId: string): Promise<PaymentViewModel> {
// Note: Assuming the API returns a single payment from the list
const dto = await this.apiClient.getPayments();
const payment = dto.payments.find((p: PaymentDTO) => p.id === paymentId);
const payment = (dto?.payments || []).find((p: PaymentDTO) => p.id === paymentId);
if (!payment) {
throw new Error(`Payment with ID ${paymentId} not found`);
}
@@ -72,7 +72,7 @@ export class PaymentService {
async getPrizes(leagueId?: string, seasonId?: string): Promise<PrizeViewModel[]> {
const query = (leagueId || seasonId) ? { ...(leagueId && { leagueId }), ...(seasonId && { seasonId }) } : undefined;
const dto = await this.apiClient.getPrizes(query);
return dto.prizes.map((prize: PrizeDTO) => new PrizeViewModel(prize));
return (dto?.prizes || []).map((prize: PrizeDTO) => new PrizeViewModel(prize));
}
/**