103 lines
3.0 KiB
TypeScript
103 lines
3.0 KiB
TypeScript
/**
|
|
* Sponsor Settings View Model
|
|
*
|
|
* View model for sponsor settings data.
|
|
*/
|
|
import { ViewModel } from "../contracts/view-models/ViewModel";
|
|
|
|
export class SponsorSettingsViewModel extends ViewModel {
|
|
profile: SponsorProfileViewModel;
|
|
notifications: NotificationSettingsViewModel;
|
|
privacy: PrivacySettingsViewModel;
|
|
|
|
constructor(data: { profile: unknown; notifications: unknown; privacy: unknown }) {
|
|
this.profile = new SponsorProfileViewModel(data.profile);
|
|
this.notifications = new NotificationSettingsViewModel(data.notifications);
|
|
this.privacy = new PrivacySettingsViewModel(data.privacy);
|
|
}
|
|
}
|
|
|
|
import { ViewModel } from "../contracts/view-models/ViewModel";
|
|
|
|
export class SponsorProfileViewModel extends ViewModel {
|
|
companyName: string;
|
|
contactName: string;
|
|
contactEmail: string;
|
|
contactPhone: string;
|
|
website: string;
|
|
description: string;
|
|
logoUrl: string | null;
|
|
industry: string;
|
|
address: {
|
|
street: string;
|
|
city: string;
|
|
country: string;
|
|
postalCode: string;
|
|
};
|
|
taxId: string;
|
|
socialLinks: {
|
|
twitter: string;
|
|
linkedin: string;
|
|
instagram: string;
|
|
};
|
|
|
|
constructor(data: unknown) {
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
const d = data as any;
|
|
this.companyName = d.companyName;
|
|
this.contactName = d.contactName;
|
|
this.contactEmail = d.contactEmail;
|
|
this.contactPhone = d.contactPhone;
|
|
this.website = d.website;
|
|
this.description = d.description;
|
|
this.logoUrl = d.logoUrl;
|
|
this.industry = d.industry;
|
|
this.address = d.address;
|
|
this.taxId = d.taxId;
|
|
this.socialLinks = d.socialLinks;
|
|
}
|
|
|
|
get fullAddress(): string {
|
|
return `${this.address.street}, ${this.address.city}, ${this.address.postalCode}, ${this.address.country}`;
|
|
}
|
|
}
|
|
|
|
import { ViewModel } from "../contracts/view-models/ViewModel";
|
|
|
|
export class NotificationSettingsViewModel extends ViewModel {
|
|
emailNewSponsorships: boolean;
|
|
emailWeeklyReport: boolean;
|
|
emailRaceAlerts: boolean;
|
|
emailPaymentAlerts: boolean;
|
|
emailNewOpportunities: boolean;
|
|
emailContractExpiry: boolean;
|
|
|
|
constructor(data: unknown) {
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
const d = data as any;
|
|
this.emailNewSponsorships = d.emailNewSponsorships;
|
|
this.emailWeeklyReport = d.emailWeeklyReport;
|
|
this.emailRaceAlerts = d.emailRaceAlerts;
|
|
this.emailPaymentAlerts = d.emailPaymentAlerts;
|
|
this.emailNewOpportunities = d.emailNewOpportunities;
|
|
this.emailContractExpiry = d.emailContractExpiry;
|
|
}
|
|
}
|
|
|
|
import { ViewModel } from "../contracts/view-models/ViewModel";
|
|
|
|
export class PrivacySettingsViewModel extends ViewModel {
|
|
publicProfile: boolean;
|
|
showStats: boolean;
|
|
showActiveSponsorships: boolean;
|
|
allowDirectContact: boolean;
|
|
|
|
constructor(data: unknown) {
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
const d = data as any;
|
|
this.publicProfile = d.publicProfile;
|
|
this.showStats = d.showStats;
|
|
this.showActiveSponsorships = d.showActiveSponsorships;
|
|
this.allowDirectContact = d.allowDirectContact;
|
|
}
|
|
} |