This commit is contained in:
2025-12-11 00:57:32 +01:00
parent 1303a14493
commit 6a427eab57
112 changed files with 6148 additions and 2272 deletions

View File

@@ -0,0 +1,26 @@
import type { ITeamRepository } from '../../domain/repositories/ITeamRepository';
import type { ITeamMembershipRepository } from '../../domain/repositories/ITeamMembershipRepository';
import type { ITeamDetailsPresenter } from '../presenters/ITeamDetailsPresenter';
/**
* Use Case for retrieving team details.
* Orchestrates domain logic and delegates presentation to the presenter.
*/
export class GetTeamDetailsUseCase {
constructor(
private readonly teamRepository: ITeamRepository,
private readonly membershipRepository: ITeamMembershipRepository,
public readonly presenter: ITeamDetailsPresenter,
) {}
async execute(teamId: string, driverId: string): Promise<void> {
const team = await this.teamRepository.findById(teamId);
if (!team) {
throw new Error('Team not found');
}
const membership = await this.membershipRepository.getMembership(teamId, driverId);
this.presenter.present(team, membership, driverId);
}
}