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,26 +1,19 @@
import type { SponsorSponsorshipsDTO } from '@/lib/types/generated/SponsorSponsorshipsDTO';
import { SponsorshipDetailViewModel } from './SponsorshipDetailViewModel';
/**
* Sponsor Sponsorships View Model
*
* View model for sponsor sponsorships data with UI-specific transformations.
*/
import { ViewModel } from "../contracts/view-models/ViewModel";
import { SponsorshipDetailViewModel } from './SponsorshipDetailViewModel';
import type { SponsorSponsorshipsViewData } from "../view-data/SponsorSponsorshipsViewData";
export class SponsorSponsorshipsViewModel extends ViewModel {
sponsorId: string;
sponsorName: string;
sponsorships: SponsorshipDetailViewModel[];
constructor(dto: SponsorSponsorshipsDTO) {
this.sponsorId = dto.sponsorId;
this.sponsorName = dto.sponsorName;
constructor(data: SponsorSponsorshipsViewData) {
super();
this.sponsorId = data.sponsorId;
this.sponsorName = data.sponsorName;
this.sponsorships = (data.sponsorships || []).map(s => new SponsorshipDetailViewModel(s));
}
// Note: The generated DTO doesn't have sponsorships array
// This will need to be added when the OpenAPI spec is updated
sponsorships: SponsorshipDetailViewModel[] = [];
/** UI-specific: Total sponsorships count */
get totalCount(): number {
return this.sponsorships.length;
@@ -51,4 +44,4 @@ export class SponsorSponsorshipsViewModel extends ViewModel {
const firstCurrency = this.sponsorships[0]?.currency || 'USD';
return `${firstCurrency} ${this.totalInvestment.toLocaleString()}`;
}
}
}