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