website refactor

This commit is contained in:
2026-01-14 13:39:24 +01:00
parent faa4c3309e
commit 8b67295442
28 changed files with 1082 additions and 851 deletions

View File

@@ -1,40 +1,49 @@
import { WalletsApiClient } from '@/lib/api/wallets/WalletsApiClient';
import type { LeagueWalletDTO, WithdrawRequestDTO, WithdrawResponseDTO } from '@/lib/api/wallets/WalletsApiClient';
import { Result } from '@/lib/contracts/Result';
import { Service } from '@/lib/contracts/services/Service';
import { LeagueWalletApiDto } from '@/lib/types/tbd/LeagueWalletApiDto';
/**
* LeagueWalletService - DTO Only
*
* Returns raw API DTOs. No ViewModels or UX logic.
* All client-side presentation logic must be handled by hooks/components.
*/
export class LeagueWalletService {
constructor(
private readonly apiClient: WalletsApiClient
) {}
/**
* Get wallet for a league
*/
async getWalletForLeague(leagueId: string): Promise<LeagueWalletDTO> {
return this.apiClient.getLeagueWallet(leagueId);
}
/**
* Withdraw from league wallet
*/
async withdraw(
leagueId: string,
amount: number,
currency: string,
seasonId: string,
destinationAccount: string
): Promise<WithdrawResponseDTO> {
const payload: WithdrawRequestDTO = {
amount,
currency,
seasonId,
destinationAccount,
export class LeagueWalletService implements Service {
async getWalletData(leagueId: string): Promise<Result<LeagueWalletApiDto, never>> {
// Mock data since backend not implemented
const mockData: LeagueWalletApiDto = {
leagueId,
balance: 15750.00,
currency: 'USD',
transactions: [
{
id: 'txn-1',
type: 'sponsorship',
amount: 5000.00,
description: 'Main sponsorship from Acme Racing',
createdAt: '2024-10-01T10:00:00Z',
status: 'completed',
},
{
id: 'txn-2',
type: 'prize',
amount: 2500.00,
description: 'Prize money from championship',
createdAt: '2024-09-15T14:30:00Z',
status: 'completed',
},
{
id: 'txn-3',
type: 'withdrawal',
amount: -1200.00,
description: 'Equipment purchase',
createdAt: '2024-09-10T09:15:00Z',
status: 'completed',
},
{
id: 'txn-4',
type: 'deposit',
amount: 5000.00,
description: 'Entry fees from season registration',
createdAt: '2024-08-01T12:00:00Z',
status: 'completed',
},
],
};
return this.apiClient.withdrawFromLeagueWallet(leagueId, payload);
return Result.ok(mockData);
}
}