view data fixes

This commit is contained in:
2026-01-23 15:30:23 +01:00
parent e22033be38
commit f8099f04bc
213 changed files with 3466 additions and 3003 deletions

View File

@@ -1,6 +1,6 @@
import { SponsorshipDetailDTO } from '@/lib/types/generated/SponsorshipDetailDTO';
import { ViewModel } from "../contracts/view-models/ViewModel";
import { CurrencyDisplay } from "../display-objects/CurrencyDisplay";
import type { SponsorshipDetailViewData } from "../view-data/SponsorshipDetailViewData";
export class SponsorshipDetailViewModel extends ViewModel {
id: string;
@@ -8,29 +8,35 @@ export class SponsorshipDetailViewModel extends ViewModel {
leagueName: string;
seasonId: string;
seasonName: string;
tier: 'main' | 'secondary';
status: string;
amount: number;
currency: string;
type: string;
entityName: string;
price: number;
impressions: number;
constructor(dto: SponsorshipDetailDTO) {
this.id = dto.id;
this.leagueId = dto.leagueId;
this.leagueName = dto.leagueName;
this.seasonId = dto.seasonId;
this.seasonName = dto.seasonName;
constructor(data: SponsorshipDetailViewData) {
super();
this.id = data.id;
this.leagueId = data.leagueId;
this.leagueName = data.leagueName;
this.seasonId = data.seasonId;
this.seasonName = data.seasonName;
this.tier = data.tier;
this.status = data.status;
this.amount = data.amount;
this.currency = data.currency;
this.type = data.type;
this.entityName = data.entityName;
this.price = data.price;
this.impressions = data.impressions;
}
// 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';
type: string = 'league';
entityName: string = '';
price: number = 0;
impressions: number = 0;
/** UI-specific: Formatted amount */
get formattedAmount(): string {
return `${this.currency} ${this.amount.toLocaleString()}`;
return CurrencyDisplay.format(this.amount, this.currency);
}
/** UI-specific: Tier badge variant */
@@ -52,4 +58,4 @@ export class SponsorshipDetailViewModel extends ViewModel {
get statusDisplay(): string {
return this.status.charAt(0).toUpperCase() + this.status.slice(1);
}
}
}