20 lines
678 B
TypeScript
20 lines
678 B
TypeScript
import type { TeamsPageDto } from '@/lib/page-queries/page-queries/TeamsPageQuery';
|
|
import type { TeamsViewData, TeamSummaryData } from '@/lib/view-data/TeamsViewData';
|
|
|
|
/**
|
|
* TeamsViewDataBuilder - Transforms TeamsPageDto into ViewData for TeamsTemplate
|
|
* Deterministic; side-effect free; no HTTP calls
|
|
*/
|
|
export class TeamsViewDataBuilder {
|
|
static build(apiDto: TeamsPageDto): TeamsViewData {
|
|
const teams: TeamSummaryData[] = apiDto.teams.map((team): TeamSummaryData => ({
|
|
teamId: team.id,
|
|
teamName: team.name,
|
|
leagueName: team.leagues[0] || '',
|
|
memberCount: team.memberCount,
|
|
logoUrl: team.logoUrl,
|
|
}));
|
|
|
|
return { teams };
|
|
}
|
|
} |