36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import type { GetTeamDetailsOutputPort } from '@core/racing/application/ports/output/GetTeamDetailsOutputPort';
|
|
import type { GetTeamDetailsOutputDTO } from '../dtos/GetTeamDetailsOutputDTO';
|
|
|
|
export class TeamDetailsPresenter {
|
|
private result: GetTeamDetailsOutputDTO | null = null;
|
|
|
|
reset() {
|
|
this.result = null;
|
|
}
|
|
|
|
async present(outputPort: GetTeamDetailsOutputPort): Promise<void> {
|
|
this.result = {
|
|
team: {
|
|
id: outputPort.team.id,
|
|
name: outputPort.team.name,
|
|
tag: outputPort.team.tag,
|
|
description: outputPort.team.description,
|
|
ownerId: outputPort.team.ownerId,
|
|
leagues: outputPort.team.leagues,
|
|
createdAt: outputPort.team.createdAt.toISOString(),
|
|
},
|
|
membership: outputPort.membership
|
|
? {
|
|
role: outputPort.membership.role,
|
|
joinedAt: outputPort.membership.joinedAt.toISOString(),
|
|
isActive: outputPort.membership.isActive,
|
|
}
|
|
: null,
|
|
canManage: outputPort.canManage,
|
|
};
|
|
}
|
|
|
|
getViewModel(): GetTeamDetailsOutputDTO | null {
|
|
return this.result;
|
|
}
|
|
} |