Files
gridpilot.gg/apps/website/lib/services/payments/MembershipFeeService.ts
2025-12-18 13:48:35 +01:00

28 lines
1000 B
TypeScript

import { MembershipFeeDto } from '@/lib/types/generated/MembershipFeeDto';
import { MembershipFeeViewModel } from '@/lib/view-models/MembershipFeeViewModel';
import { PaymentsApiClient } from '../../api/payments/PaymentsApiClient';
// TODO: This DTO should be generated from OpenAPI spec when the endpoint is added
export interface GetMembershipFeesOutputDto {
fees: MembershipFeeDto[];
}
/**
* Membership Fee Service
*
* Orchestrates membership fee operations by coordinating API calls and view model creation.
* All dependencies are injected via constructor.
*/
export class MembershipFeeService {
constructor(
private readonly apiClient: PaymentsApiClient
) {}
/**
* Get membership fees by league ID with view model transformation
*/
async getMembershipFees(leagueId: string): Promise<MembershipFeeViewModel[]> {
const dto = await this.apiClient.getMembershipFees(leagueId);
return dto.fees.map((fee: MembershipFeeDto) => new MembershipFeeViewModel(fee));
}
}