harden media
This commit is contained in:
@@ -17,7 +17,7 @@ export class DashboardDriverSummaryViewModel {
|
||||
}
|
||||
|
||||
get avatarUrl(): string {
|
||||
return this.dto.avatarUrl;
|
||||
return this.dto.avatarUrl || '';
|
||||
}
|
||||
|
||||
get country(): string {
|
||||
@@ -153,7 +153,7 @@ export class DashboardFriendSummaryViewModel {
|
||||
}
|
||||
|
||||
get avatarUrl(): string {
|
||||
return this.dto.avatarUrl;
|
||||
return this.dto.avatarUrl || '';
|
||||
}
|
||||
|
||||
get country(): string {
|
||||
|
||||
@@ -30,7 +30,7 @@ describe('DriverViewModel', () => {
|
||||
|
||||
expect(viewModel.id).toBe('driver-123');
|
||||
expect(viewModel.name).toBe('John Doe');
|
||||
expect(viewModel.avatarUrl).toBeUndefined();
|
||||
expect(viewModel.avatarUrl).toBeNull();
|
||||
expect(viewModel.iracingId).toBeUndefined();
|
||||
expect(viewModel.rating).toBeUndefined();
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
export class DriverViewModel {
|
||||
id: string;
|
||||
name: string;
|
||||
avatarUrl?: string;
|
||||
avatarUrl: string | null;
|
||||
iracingId?: string;
|
||||
rating?: number;
|
||||
country?: string;
|
||||
@@ -17,7 +17,7 @@ export class DriverViewModel {
|
||||
constructor(dto: {
|
||||
id: string;
|
||||
name: string;
|
||||
avatarUrl?: string;
|
||||
avatarUrl?: string | null;
|
||||
iracingId?: string;
|
||||
rating?: number;
|
||||
country?: string;
|
||||
@@ -26,7 +26,7 @@ export class DriverViewModel {
|
||||
}) {
|
||||
this.id = dto.id;
|
||||
this.name = dto.name;
|
||||
if (dto.avatarUrl !== undefined) this.avatarUrl = dto.avatarUrl;
|
||||
this.avatarUrl = dto.avatarUrl ?? null;
|
||||
if (dto.iracingId !== undefined) this.iracingId = dto.iracingId;
|
||||
if (dto.rating !== undefined) this.rating = dto.rating;
|
||||
if (dto.country !== undefined) this.country = dto.country;
|
||||
|
||||
@@ -186,6 +186,7 @@ export class LeagueDetailPageViewModel {
|
||||
const driver = new DriverViewModel({
|
||||
id: driverDto.id,
|
||||
name: driverDto.name,
|
||||
avatarUrl: (driverDto as any).avatarUrl ?? null,
|
||||
iracingId: driverDto.iracingId,
|
||||
});
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ export interface LeagueSummaryViewModel {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
logoUrl: string | null;
|
||||
ownerId: string;
|
||||
createdAt: string;
|
||||
maxDrivers: number;
|
||||
|
||||
@@ -12,7 +12,7 @@ export class RaceDetailEntryViewModel {
|
||||
this.id = dto.id;
|
||||
this.name = dto.name;
|
||||
this.country = dto.country;
|
||||
this.avatarUrl = dto.avatarUrl;
|
||||
this.avatarUrl = dto.avatarUrl || '';
|
||||
this.isCurrentUser = dto.id === currentDriverId;
|
||||
this.rating = rating ?? null;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ interface TeamCardDTO {
|
||||
name: string;
|
||||
tag: string;
|
||||
description: string;
|
||||
logoUrl?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -16,11 +17,13 @@ export class TeamCardViewModel {
|
||||
readonly name: string;
|
||||
readonly tag: string;
|
||||
readonly description: string;
|
||||
readonly logoUrl?: string;
|
||||
|
||||
constructor(dto: TeamCardDTO | TeamListItemDTO) {
|
||||
this.id = dto.id;
|
||||
this.name = dto.name;
|
||||
this.tag = dto.tag;
|
||||
this.description = dto.description;
|
||||
this.logoUrl = 'logoUrl' in dto ? dto.logoUrl : undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export class TeamJoinRequestViewModel {
|
||||
this.teamId = dto.teamId;
|
||||
this.requestStatus = dto.status;
|
||||
this.requestedAt = dto.requestedAt;
|
||||
this.avatarUrl = dto.avatarUrl;
|
||||
this.avatarUrl = dto.avatarUrl || '';
|
||||
this.currentUserId = currentUserId;
|
||||
this.isOwner = isOwner;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export class TeamMemberViewModel {
|
||||
this.role = normalizeTeamRole(dto.role);
|
||||
this.joinedAt = dto.joinedAt;
|
||||
this.isActive = dto.isActive;
|
||||
this.avatarUrl = dto.avatarUrl;
|
||||
this.avatarUrl = dto.avatarUrl || '';
|
||||
this.currentUserId = currentUserId;
|
||||
this.teamOwnerId = teamOwnerId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user