auth
This commit is contained in:
@@ -4,18 +4,22 @@ export class SessionViewModel {
|
||||
userId: string;
|
||||
email: string;
|
||||
displayName: string;
|
||||
avatarUrl?: string | null;
|
||||
|
||||
constructor(dto: AuthenticatedUserDTO) {
|
||||
this.userId = dto.userId;
|
||||
this.email = dto.email;
|
||||
this.displayName = dto.displayName;
|
||||
|
||||
const anyDto = dto as unknown as { primaryDriverId?: unknown; driverId?: unknown };
|
||||
const anyDto = dto as unknown as { primaryDriverId?: unknown; driverId?: unknown; avatarUrl?: unknown };
|
||||
if (typeof anyDto.primaryDriverId === 'string' && anyDto.primaryDriverId) {
|
||||
this.driverId = anyDto.primaryDriverId;
|
||||
} else if (typeof anyDto.driverId === 'string' && anyDto.driverId) {
|
||||
this.driverId = anyDto.driverId;
|
||||
}
|
||||
if (anyDto.avatarUrl !== undefined) {
|
||||
this.avatarUrl = anyDto.avatarUrl as string | null;
|
||||
}
|
||||
}
|
||||
|
||||
// Note: The generated DTO doesn't have these fields
|
||||
@@ -32,12 +36,14 @@ export class SessionViewModel {
|
||||
email: string;
|
||||
displayName: string;
|
||||
primaryDriverId?: string | null;
|
||||
avatarUrl?: string | null;
|
||||
} {
|
||||
return {
|
||||
userId: this.userId,
|
||||
email: this.email,
|
||||
displayName: this.displayName,
|
||||
primaryDriverId: this.driverId ?? null,
|
||||
avatarUrl: this.avatarUrl,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user