36 lines
800 B
TypeScript
36 lines
800 B
TypeScript
// Note: No generated DTO available for Sponsor yet
|
|
interface SponsorDTO {
|
|
id: string;
|
|
name: string;
|
|
logoUrl?: string;
|
|
websiteUrl?: string;
|
|
}
|
|
|
|
export class SponsorViewModel {
|
|
id: string;
|
|
name: string;
|
|
declare logoUrl?: string;
|
|
declare websiteUrl?: string;
|
|
|
|
constructor(dto: SponsorDTO) {
|
|
this.id = dto.id;
|
|
this.name = dto.name;
|
|
if (dto.logoUrl !== undefined) this.logoUrl = dto.logoUrl;
|
|
if (dto.websiteUrl !== undefined) this.websiteUrl = dto.websiteUrl;
|
|
}
|
|
|
|
/** UI-specific: Display name */
|
|
get displayName(): string {
|
|
return this.name;
|
|
}
|
|
|
|
/** UI-specific: Whether has website */
|
|
get hasWebsite(): boolean {
|
|
return !!this.websiteUrl;
|
|
}
|
|
|
|
/** UI-specific: Website link text */
|
|
get websiteLinkText(): string {
|
|
return 'Visit Website';
|
|
}
|
|
} |