view models
This commit is contained in:
@@ -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()}`;
|
||||
|
||||
Reference in New Issue
Block a user