view models

This commit is contained in:
2025-12-18 00:08:47 +01:00
parent f7a56a92ce
commit 7c449af311
56 changed files with 2594 additions and 206 deletions

View File

@@ -1,19 +1,24 @@
import { SessionDataDto } from '../dtos';
import { AuthenticatedUserDTO } from '../types/generated/AuthenticatedUserDTO';
export class SessionViewModel implements SessionDataDto {
export class SessionViewModel implements AuthenticatedUserDTO {
userId: string;
email: string;
displayName?: string;
driverId?: string;
isAuthenticated: boolean;
displayName: string;
constructor(dto: SessionDataDto) {
Object.assign(this, dto);
constructor(dto: AuthenticatedUserDTO) {
this.userId = dto.userId;
this.email = dto.email;
this.displayName = dto.displayName;
}
// Note: The generated DTO doesn't have these fields
// These will need to be added when the OpenAPI spec is updated
driverId?: string;
isAuthenticated: boolean = true;
/** UI-specific: User greeting */
get greeting(): string {
return `Hello, ${this.displayName || this.email}!`;
return `Hello, ${this.displayName}!`;
}
/** UI-specific: Avatar initials */