website cleanup
This commit is contained in:
@@ -18,6 +18,7 @@ import { RaceViewModel } from "@/lib/view-models/RaceViewModel";
|
||||
import { SubmitBlocker, ThrottleBlocker } from "@/lib/blockers";
|
||||
import { RaceDTO } from "@/lib/types/generated/RaceDTO";
|
||||
import { LeagueStatsDTO } from "@/lib/types/generated/LeagueStatsDTO";
|
||||
import { LeagueScoringConfigDTO } from "@/lib/types/LeagueScoringConfigDTO";
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { MembershipFeeDto } from '@/lib/types/generated/MembershipFeeDto';
|
||||
import type { MemberPaymentDto } from '@/lib/types/generated/MemberPaymentDto';
|
||||
import { MembershipFeeDTO } from '@/lib/types/generated/MembershipFeeDTO';
|
||||
import type { MemberPaymentDTO } from '@/lib/types/generated/MemberPaymentDTO';
|
||||
import { MembershipFeeViewModel } from '@/lib/view-models/MembershipFeeViewModel';
|
||||
import { PaymentsApiClient } from '../../api/payments/PaymentsApiClient';
|
||||
|
||||
// Response shape as returned by the membership-fees payments endpoint; mirrors the API contract until a generated type is introduced
|
||||
export interface GetMembershipFeesOutputDto {
|
||||
fee: MembershipFeeDto | null;
|
||||
payments: MemberPaymentDto[];
|
||||
fee: MembershipFeeDTO | null;
|
||||
payments: MemberPaymentDTO[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -23,7 +23,7 @@ export class MembershipFeeService {
|
||||
/**
|
||||
* Get membership fees by league ID with view model transformation
|
||||
*/
|
||||
async getMembershipFees(leagueId: string): Promise<{ fee: MembershipFeeViewModel | null; payments: MemberPaymentDto[] }> {
|
||||
async getMembershipFees(leagueId: string): Promise<{ fee: MembershipFeeViewModel | null; payments: MemberPaymentDTO[] }> {
|
||||
const dto: GetMembershipFeesOutputDto = await this.apiClient.getMembershipFees({ leagueId });
|
||||
return {
|
||||
fee: dto.fee ? new MembershipFeeViewModel(dto.fee) : null,
|
||||
|
||||
@@ -3,8 +3,8 @@ import { PaymentViewModel } from '@/lib/view-models/PaymentViewModel';
|
||||
import { PrizeViewModel } from '@/lib/view-models/PrizeViewModel';
|
||||
import { WalletViewModel } from '@/lib/view-models/WalletViewModel';
|
||||
import type { PaymentsApiClient } from '../../api/payments/PaymentsApiClient';
|
||||
import type { PaymentDTO } from '../../types/generated/PaymentDto';
|
||||
import type { PrizeDto } from '../../types/generated/PrizeDto';
|
||||
import type { PaymentDTO } from '../../types/generated/PaymentDTO';
|
||||
import type { PrizeDTO } from '../../types/generated/PrizeDTO';
|
||||
|
||||
// Local payment creation request matching the Payments API contract until a shared generated type is introduced
|
||||
type CreatePaymentRequest = {
|
||||
@@ -32,7 +32,7 @@ export class PaymentService {
|
||||
* Get all payments with optional filters
|
||||
*/
|
||||
async getPayments(leagueId?: string, payerId?: string): Promise<PaymentViewModel[]> {
|
||||
const query = leagueId || payerId ? { leagueId, payerId } : undefined;
|
||||
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));
|
||||
}
|
||||
@@ -62,7 +62,7 @@ export class PaymentService {
|
||||
* Get membership fees for a league
|
||||
*/
|
||||
async getMembershipFees(leagueId: string, driverId?: string): Promise<MembershipFeeViewModel | null> {
|
||||
const dto = await this.apiClient.getMembershipFees({ leagueId, driverId });
|
||||
const dto = await this.apiClient.getMembershipFees({ leagueId, ...(driverId && { driverId }) });
|
||||
return dto.fee ? new MembershipFeeViewModel(dto.fee) : null;
|
||||
}
|
||||
|
||||
@@ -70,9 +70,9 @@ export class PaymentService {
|
||||
* Get prizes with optional filters
|
||||
*/
|
||||
async getPrizes(leagueId?: string, seasonId?: string): Promise<PrizeViewModel[]> {
|
||||
const query = leagueId || seasonId ? { leagueId, seasonId } : undefined;
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,7 +22,7 @@ export class RaceService {
|
||||
driverId: string
|
||||
): Promise<RaceDetailViewModel> {
|
||||
const dto = await this.apiClient.getDetail(raceId, driverId);
|
||||
return new RaceDetailViewModel(dto);
|
||||
return new RaceDetailViewModel(dto, driverId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user