26 lines
866 B
TypeScript
26 lines
866 B
TypeScript
import type { ProfileLeaguesPageDto } from '@/lib/page-queries/page-queries/ProfileLeaguesPageQuery';
|
|
import type { ProfileLeaguesViewData } from '@/templates/view-data/ProfileLeaguesViewData';
|
|
|
|
/**
|
|
* Presenter for Profile Leagues page
|
|
* Pure mapping from Page DTO to ViewData
|
|
*/
|
|
export class ProfileLeaguesPresenter {
|
|
static toViewData(pageDto: ProfileLeaguesPageDto): ProfileLeaguesViewData {
|
|
return {
|
|
ownedLeagues: pageDto.ownedLeagues.map(league => ({
|
|
leagueId: league.leagueId,
|
|
name: league.name,
|
|
description: league.description,
|
|
membershipRole: league.membershipRole,
|
|
})),
|
|
memberLeagues: pageDto.memberLeagues.map(league => ({
|
|
leagueId: league.leagueId,
|
|
name: league.name,
|
|
description: league.description,
|
|
membershipRole: league.membershipRole,
|
|
})),
|
|
};
|
|
}
|
|
}
|