website cleanup
This commit is contained in:
@@ -1,24 +1,25 @@
|
||||
// Note: No generated DTO available for TeamJoinRequest yet
|
||||
export interface TeamJoinRequestDTO {
|
||||
id: string;
|
||||
teamId: string;
|
||||
driverId: string;
|
||||
requestedAt: string;
|
||||
message?: string;
|
||||
}
|
||||
import type { TeamJoinRequestDTO } from '@/lib/types/generated/TeamJoinRequestDTO';
|
||||
|
||||
export class TeamJoinRequestViewModel {
|
||||
id: string;
|
||||
teamId: string;
|
||||
requestId: string;
|
||||
driverId: string;
|
||||
driverName: string;
|
||||
teamId: string;
|
||||
requestStatus: string;
|
||||
requestedAt: string;
|
||||
message?: string;
|
||||
avatarUrl: string;
|
||||
|
||||
private currentUserId: string;
|
||||
private isOwner: boolean;
|
||||
private readonly currentUserId: string;
|
||||
private readonly isOwner: boolean;
|
||||
|
||||
constructor(dto: TeamJoinRequestDTO, currentUserId: string, isOwner: boolean) {
|
||||
Object.assign(this, dto);
|
||||
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;
|
||||
}
|
||||
@@ -33,13 +34,10 @@ export class TeamJoinRequestViewModel {
|
||||
return new Date(this.requestedAt).toLocaleString();
|
||||
}
|
||||
|
||||
/** UI-specific: Request status (pending) */
|
||||
get status(): string {
|
||||
return 'Pending';
|
||||
}
|
||||
|
||||
/** UI-specific: Status color */
|
||||
get statusColor(): string {
|
||||
if (this.requestStatus === 'approved') return 'green';
|
||||
if (this.requestStatus === 'rejected') return 'red';
|
||||
return 'yellow';
|
||||
}
|
||||
|
||||
@@ -52,4 +50,4 @@ export class TeamJoinRequestViewModel {
|
||||
get rejectButtonText(): string {
|
||||
return 'Reject';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user