website refactor
This commit is contained in:
25
apps/website/lib/presenters/ProfileLeaguesPresenter.ts
Normal file
25
apps/website/lib/presenters/ProfileLeaguesPresenter.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
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,
|
||||
})),
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user