api client refactor
This commit is contained in:
27
apps/website/lib/view-models/SponsorViewModel.ts
Normal file
27
apps/website/lib/view-models/SponsorViewModel.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { SponsorDto } from '../dtos';
|
||||
|
||||
export class SponsorViewModel implements SponsorDto {
|
||||
id: string;
|
||||
name: string;
|
||||
logoUrl?: string;
|
||||
websiteUrl?: string;
|
||||
|
||||
constructor(dto: SponsorDto) {
|
||||
Object.assign(this, dto);
|
||||
}
|
||||
|
||||
/** 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';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user