view data fixes
Some checks failed
Contract Testing / contract-snapshot (pull_request) Has been cancelled
Contract Testing / contract-tests (pull_request) Has been cancelled

This commit is contained in:
2026-01-25 00:12:30 +01:00
parent 1b0a1f4aee
commit 6c07abe5e7
37 changed files with 400 additions and 185 deletions

View File

@@ -14,24 +14,29 @@ export function useLeagueWalletPageData(leagueId: string) {
queryKey: ['leagueWallet', leagueId],
queryFn: async () => {
const dto = await leagueWalletService.getWalletForLeague(leagueId);
// Transform DTO to ViewModel at client boundary
const transactions = dto.transactions.map(t => new WalletTransactionViewModel({
// Transform DTO to ViewData at client boundary
const transactions = dto.transactions.map(t => ({
id: t.id,
type: t.type as any,
description: t.description,
amount: t.amount,
fee: 0,
netAmount: t.amount,
date: new globalThis.Date(t.createdAt),
date: new globalThis.Date(t.createdAt).toISOString(),
status: t.status,
}));
return new LeagueWalletViewModel({
leagueId,
balance: dto.balance,
currency: dto.currency,
formattedBalance: '',
totalRevenue: dto.balance, // Fallback
formattedTotalRevenue: '',
totalFees: 0,
formattedTotalFees: '',
totalWithdrawals: 0,
pendingPayouts: 0,
formattedPendingPayouts: '',
currency: dto.currency,
transactions,
canWithdraw: true,
withdrawalBlockReason: undefined,