view models
This commit is contained in:
@@ -1,14 +1,25 @@
|
||||
import { DriverDto } from '../dtos';
|
||||
// Note: No generated DTO available for UserProfile yet
|
||||
interface UserProfileDTO {
|
||||
id: string;
|
||||
name: string;
|
||||
avatarUrl?: string;
|
||||
iracingId?: string;
|
||||
rating?: number;
|
||||
}
|
||||
|
||||
export class UserProfileViewModel implements DriverDto {
|
||||
export class UserProfileViewModel {
|
||||
id: string;
|
||||
name: string;
|
||||
avatarUrl?: string;
|
||||
iracingId?: string;
|
||||
rating?: number;
|
||||
|
||||
constructor(dto: DriverDto) {
|
||||
Object.assign(this, dto);
|
||||
constructor(dto: UserProfileDTO) {
|
||||
this.id = dto.id;
|
||||
this.name = dto.name;
|
||||
if (dto.avatarUrl !== undefined) this.avatarUrl = dto.avatarUrl;
|
||||
if (dto.iracingId !== undefined) this.iracingId = dto.iracingId;
|
||||
if (dto.rating !== undefined) this.rating = dto.rating;
|
||||
}
|
||||
|
||||
/** UI-specific: Formatted rating */
|
||||
|
||||
Reference in New Issue
Block a user