view models

This commit is contained in:
2025-12-18 13:48:35 +01:00
parent cc2553876a
commit 91adbb9c83
71 changed files with 3119 additions and 359 deletions

View File

@@ -1,5 +1,5 @@
import { WalletDto } from '../types/generated/WalletDto';
import { WalletTransactionViewModel } from './WalletTransactionViewModel';
import { WalletTransactionViewModel, FullTransactionDto } from './WalletTransactionViewModel';
export class WalletViewModel implements WalletDto {
id: string;
@@ -11,7 +11,7 @@ export class WalletViewModel implements WalletDto {
createdAt: string;
currency: string;
constructor(dto: WalletDto & { transactions?: any[] }) {
constructor(dto: WalletDto & { transactions?: FullTransactionDto[] }) {
this.id = dto.id;
this.leagueId = dto.leagueId;
this.balance = dto.balance;
@@ -20,16 +20,11 @@ export class WalletViewModel implements WalletDto {
this.totalWithdrawn = dto.totalWithdrawn;
this.createdAt = dto.createdAt;
this.currency = dto.currency;
// Map transactions if provided
if (dto.transactions) {
this.transactions = dto.transactions.map(t => new WalletTransactionViewModel(t));
}
this.transactions = dto.transactions?.map(t => new WalletTransactionViewModel(t)) || [];
}
// Note: The generated DTO doesn't have driverId or transactions
// These will need to be added when the OpenAPI spec is updated
driverId: string = '';
transactions: WalletTransactionViewModel[] = [];
/** UI-specific: Formatted balance */