41 lines
935 B
TypeScript
41 lines
935 B
TypeScript
import { TeamSummaryDto } from '../dtos';
|
|
|
|
export class TeamSummaryViewModel implements TeamSummaryDto {
|
|
id: string;
|
|
name: string;
|
|
logoUrl?: string;
|
|
memberCount: number;
|
|
rating: number;
|
|
|
|
private maxMembers = 10; // Assuming max members
|
|
|
|
constructor(dto: TeamSummaryDto) {
|
|
Object.assign(this, dto);
|
|
}
|
|
|
|
/** UI-specific: Whether team is full */
|
|
get isFull(): boolean {
|
|
return this.memberCount >= this.maxMembers;
|
|
}
|
|
|
|
/** UI-specific: Rating display */
|
|
get ratingDisplay(): string {
|
|
return this.rating.toFixed(0);
|
|
}
|
|
|
|
/** UI-specific: Member count display */
|
|
get memberCountDisplay(): string {
|
|
return `${this.memberCount}/${this.maxMembers}`;
|
|
}
|
|
|
|
/** UI-specific: Status indicator */
|
|
get statusIndicator(): string {
|
|
if (this.isFull) return 'Full';
|
|
return 'Open';
|
|
}
|
|
|
|
/** UI-specific: Status color */
|
|
get statusColor(): string {
|
|
return this.isFull ? 'red' : 'green';
|
|
}
|
|
} |