services refactor

This commit is contained in:
2025-12-17 22:17:02 +01:00
parent 26f7a2b6aa
commit 055a7f67b5
93 changed files with 7434 additions and 659 deletions

View File

@@ -0,0 +1,44 @@
import type { GetEntitySponsorshipPricingResultDto } from '../dtos';
/**
* Sponsorship Pricing View Model
*
* View model for sponsorship pricing data with UI-specific transformations.
*/
export class SponsorshipPricingViewModel {
mainSlotPrice: number;
secondarySlotPrice: number;
currency: string;
constructor(dto: GetEntitySponsorshipPricingResultDto) {
this.mainSlotPrice = dto.mainSlotPrice;
this.secondarySlotPrice = dto.secondarySlotPrice;
this.currency = dto.currency;
}
/** UI-specific: Formatted main slot price */
get formattedMainSlotPrice(): string {
return `${this.currency} ${this.mainSlotPrice.toLocaleString()}`;
}
/** UI-specific: Formatted secondary slot price */
get formattedSecondarySlotPrice(): string {
return `${this.currency} ${this.secondarySlotPrice.toLocaleString()}`;
}
/** UI-specific: Price difference */
get priceDifference(): number {
return this.mainSlotPrice - this.secondarySlotPrice;
}
/** UI-specific: Formatted price difference */
get formattedPriceDifference(): string {
return `${this.currency} ${this.priceDifference.toLocaleString()}`;
}
/** UI-specific: Discount percentage for secondary slot */
get secondaryDiscountPercentage(): number {
if (this.mainSlotPrice === 0) return 0;
return Math.round((1 - this.secondarySlotPrice / this.mainSlotPrice) * 100);
}
}