Files
gridpilot.gg/apps/website/lib/presenters/ProfileLeaguesPresenter.ts
2026-01-12 01:01:49 +01:00

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,
})),
};
}
}