api client refactor

This commit is contained in:
2025-12-17 18:01:47 +01:00
parent bab55955e1
commit 4177644b18
190 changed files with 6403 additions and 1624 deletions

View File

@@ -0,0 +1,38 @@
import { PaymentDto } from '../dtos';
export class PaymentViewModel implements PaymentDto {
id: string;
amount: number;
currency: string;
status: string;
createdAt: string;
constructor(dto: PaymentDto) {
Object.assign(this, dto);
}
/** UI-specific: Formatted amount */
get formattedAmount(): string {
return `${this.currency} ${this.amount.toFixed(2)}`;
}
/** UI-specific: Status color */
get statusColor(): string {
switch (this.status) {
case 'completed': return 'green';
case 'pending': return 'yellow';
case 'failed': return 'red';
default: return 'gray';
}
}
/** UI-specific: Formatted created date */
get formattedCreatedAt(): string {
return new Date(this.createdAt).toLocaleString();
}
/** UI-specific: Status display */
get statusDisplay(): string {
return this.status.charAt(0).toUpperCase() + this.status.slice(1);
}
}