54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
import { PendingRequestDTO } from '@/components/sponsors/PendingSponsorshipRequests';
|
|
|
|
export class SponsorshipRequestViewModel {
|
|
id: string;
|
|
sponsorId: string;
|
|
sponsorName: string;
|
|
sponsorLogo?: string;
|
|
tier: 'main' | 'secondary';
|
|
offeredAmount: number;
|
|
currency: string;
|
|
formattedAmount: string;
|
|
message?: string;
|
|
createdAt: Date;
|
|
platformFee: number;
|
|
netAmount: number;
|
|
|
|
constructor(dto: PendingRequestDTO) {
|
|
this.id = dto.id;
|
|
this.sponsorId = dto.sponsorId;
|
|
this.sponsorName = dto.sponsorName;
|
|
this.sponsorLogo = dto.sponsorLogo;
|
|
this.tier = dto.tier;
|
|
this.offeredAmount = dto.offeredAmount;
|
|
this.currency = dto.currency;
|
|
this.formattedAmount = dto.formattedAmount;
|
|
this.message = dto.message;
|
|
this.createdAt = dto.createdAt;
|
|
this.platformFee = dto.platformFee;
|
|
this.netAmount = dto.netAmount;
|
|
}
|
|
|
|
/** UI-specific: Formatted date */
|
|
get formattedDate(): string {
|
|
return this.createdAt.toLocaleDateString('en-US', {
|
|
month: 'short',
|
|
day: 'numeric',
|
|
});
|
|
}
|
|
|
|
/** UI-specific: Net amount in dollars */
|
|
get netAmountDollars(): string {
|
|
return `$${(this.netAmount / 100).toFixed(2)}`;
|
|
}
|
|
|
|
/** UI-specific: Tier display */
|
|
get tierDisplay(): string {
|
|
return this.tier === 'main' ? 'Main Sponsor' : 'Secondary';
|
|
}
|
|
|
|
/** UI-specific: Tier badge variant */
|
|
get tierBadgeVariant(): 'primary' | 'secondary' {
|
|
return this.tier === 'main' ? 'primary' : 'secondary';
|
|
}
|
|
} |