view data fixes

This commit is contained in:
2026-01-23 15:30:23 +01:00
parent e22033be38
commit f8099f04bc
213 changed files with 3466 additions and 3003 deletions

View File

@@ -1,34 +1,25 @@
import type { TeamJoinRequestDTO } from '@/lib/types/generated/TeamJoinRequestDTO';
import { ViewModel } from "../contracts/view-models/ViewModel";
import { DateDisplay } from "../display-objects/DateDisplay";
import type { TeamJoinRequestViewData } from "../view-data/TeamJoinRequestViewData";
export class TeamJoinRequestViewModel extends ViewModel {
requestId: string;
driverId: string;
driverName: string;
teamId: string;
requestStatus: string;
requestedAt: string;
avatarUrl: string;
private readonly data: TeamJoinRequestViewData;
private readonly currentUserId: string;
private readonly isOwner: boolean;
constructor(dto: TeamJoinRequestDTO, currentUserId: string, isOwner: boolean) {
this.requestId = dto.requestId;
this.driverId = dto.driverId;
this.driverName = dto.driverName;
this.teamId = dto.teamId;
this.requestStatus = dto.status;
this.requestedAt = dto.requestedAt;
this.avatarUrl = dto.avatarUrl || '';
this.currentUserId = currentUserId;
this.isOwner = isOwner;
constructor(data: TeamJoinRequestViewData) {
super();
this.data = data;
}
get id(): string {
return this.requestId;
}
get id(): string { return this.data.requestId; }
get requestId(): string { return this.data.requestId; }
get driverId(): string { return this.data.driverId; }
get driverName(): string { return this.data.driverName; }
get teamId(): string { return this.data.teamId; }
get requestStatus(): string { return this.data.status; }
get requestedAt(): string { return this.data.requestedAt; }
get avatarUrl(): string { return this.data.avatarUrl || ''; }
get currentUserId(): string { return this.data.currentUserId; }
get isOwner(): boolean { return this.data.isOwner; }
get status(): string {
if (this.requestStatus === 'pending') return 'Pending';
@@ -44,7 +35,7 @@ export class TeamJoinRequestViewModel extends ViewModel {
/** UI-specific: Formatted requested date */
get formattedRequestedAt(): string {
return new Date(this.requestedAt).toLocaleString();
return DateDisplay.formatDateTime(this.requestedAt);
}
/** UI-specific: Status color */