view models

This commit is contained in:
2025-12-18 00:08:47 +01:00
parent f7a56a92ce
commit 7c449af311
56 changed files with 2594 additions and 206 deletions

View File

@@ -1,19 +1,27 @@
import { SponsorshipDetailDto } from '../dtos';
import { SponsorshipDetailDTO } from '../types/generated/SponsorshipDetailDTO';
export class SponsorshipDetailViewModel implements SponsorshipDetailDto {
export class SponsorshipDetailViewModel implements SponsorshipDetailDTO {
id: string;
leagueId: string;
leagueName: string;
seasonId: string;
tier: 'main' | 'secondary';
status: string;
amount: number;
currency: string;
seasonName: string;
constructor(dto: SponsorshipDetailDto) {
Object.assign(this, dto);
constructor(dto: SponsorshipDetailDTO) {
this.id = dto.id;
this.leagueId = dto.leagueId;
this.leagueName = dto.leagueName;
this.seasonId = dto.seasonId;
this.seasonName = dto.seasonName;
}
// Note: The generated DTO is incomplete
// These fields will need to be added when the OpenAPI spec is updated
tier: 'main' | 'secondary' = 'secondary';
status: string = 'active';
amount: number = 0;
currency: string = 'USD';
/** UI-specific: Formatted amount */
get formattedAmount(): string {
return `${this.currency} ${this.amount.toLocaleString()}`;