website refactor

This commit is contained in:
2026-01-12 01:01:49 +01:00
parent 5ca6023a5a
commit fefd8d1cd6
294 changed files with 4628 additions and 4991 deletions

View File

@@ -1,37 +0,0 @@
import { WalletViewModel } from '@/lib/view-models/WalletViewModel';
import { PaymentsApiClient } from '../../api/payments/PaymentsApiClient';
import { FullTransactionDto } from '../../view-models/WalletTransactionViewModel';
/**
* Wallet Service
*
* Orchestrates wallet operations by coordinating API calls and view model creation.
* All dependencies are injected via constructor.
*/
export class WalletService {
constructor(
private readonly apiClient: PaymentsApiClient
) {}
/**
* Get wallet by driver ID with view model transformation
*/
async getWallet(leagueId?: string): Promise<WalletViewModel> {
const { wallet, transactions } = await this.apiClient.getWallet({ leagueId });
// Convert TransactionDTO to FullTransactionDto format
const convertedTransactions: FullTransactionDto[] = transactions.map(t => ({
id: t.id,
type: t.type as 'sponsorship' | 'membership' | 'withdrawal' | 'prize',
description: t.description,
amount: t.amount,
fee: t.amount * 0.05, // Calculate fee (5%)
netAmount: t.amount * 0.95, // Calculate net amount
date: new Date(t.createdAt),
status: 'completed',
referenceId: t.referenceId
}));
return new WalletViewModel({ ...wallet, transactions: convertedTransactions });
}
}