api client refactor
This commit is contained in:
32
apps/website/lib/view-models/MembershipFeeViewModel.ts
Normal file
32
apps/website/lib/view-models/MembershipFeeViewModel.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { MembershipFeeDto } from '../dtos';
|
||||
|
||||
export class MembershipFeeViewModel implements MembershipFeeDto {
|
||||
leagueId: string;
|
||||
amount: number;
|
||||
currency: string;
|
||||
period: string;
|
||||
|
||||
constructor(dto: MembershipFeeDto) {
|
||||
Object.assign(this, dto);
|
||||
}
|
||||
|
||||
/** UI-specific: Formatted amount */
|
||||
get formattedAmount(): string {
|
||||
return `${this.currency} ${this.amount.toFixed(2)}`;
|
||||
}
|
||||
|
||||
/** UI-specific: Period display */
|
||||
get periodDisplay(): string {
|
||||
switch (this.period) {
|
||||
case 'monthly': return 'Monthly';
|
||||
case 'yearly': return 'Yearly';
|
||||
case 'season': return 'Per Season';
|
||||
default: return this.period;
|
||||
}
|
||||
}
|
||||
|
||||
/** UI-specific: Amount per period */
|
||||
get amountPerPeriod(): string {
|
||||
return `${this.formattedAmount} ${this.periodDisplay.toLowerCase()}`;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user