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,16 +1,32 @@
import type { LeagueAdminDto } from '../dtos';
import type { LeagueMemberViewModel, LeagueJoinRequestViewModel } from './';
import type { LeagueMemberViewModel } from './LeagueMemberViewModel';
import type { LeagueJoinRequestViewModel } from './LeagueJoinRequestViewModel';
/**
* League admin view model
* Transform from DTO to ViewModel with UI fields
*/
export interface LeagueAdminViewModel {
config: LeagueAdminDto['config'];
export class LeagueAdminViewModel {
config: any;
members: LeagueMemberViewModel[];
joinRequests: LeagueJoinRequestViewModel[];
// Total pending requests count
pendingRequestsCount: number;
// Whether there are any pending requests
hasPendingRequests: boolean;
constructor(dto: {
config: any;
members: LeagueMemberViewModel[];
joinRequests: LeagueJoinRequestViewModel[];
}) {
this.config = dto.config;
this.members = dto.members;
this.joinRequests = dto.joinRequests;
}
/** UI-specific: Total pending requests count */
get pendingRequestsCount(): number {
return this.joinRequests.length;
}
/** UI-specific: Whether there are any pending requests */
get hasPendingRequests(): boolean {
return this.joinRequests.length > 0;
}
}