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,21 +1,25 @@
import type { SponsorDashboardDto } from '../dtos';
import type { SponsorDashboardDTO } from '../types/generated/SponsorDashboardDTO';
/**
* Sponsor Dashboard View Model
*
* View model for sponsor dashboard data with UI-specific transformations.
*/
export class SponsorDashboardViewModel implements SponsorDashboardDto {
export class SponsorDashboardViewModel implements SponsorDashboardDTO {
sponsorId: string;
sponsorName: string;
totalSponsorships: number;
activeSponsorships: number;
totalInvestment: number;
constructor(dto: SponsorDashboardDto) {
Object.assign(this, dto);
constructor(dto: SponsorDashboardDTO) {
this.sponsorId = dto.sponsorId;
this.sponsorName = dto.sponsorName;
}
// Note: The generated DTO doesn't include these fields yet
// These will need to be added when the OpenAPI spec is updated
totalSponsorships: number = 0;
activeSponsorships: number = 0;
totalInvestment: number = 0;
/** UI-specific: Formatted total investment */
get formattedTotalInvestment(): string {
return `$${this.totalInvestment.toLocaleString()}`;