view models
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user