This commit is contained in:
2025-12-10 18:28:32 +01:00
parent 6d61be9c51
commit 1303a14493
108 changed files with 3366 additions and 1559 deletions

View File

@@ -1,19 +1,19 @@
import type { ITeamRepository } from '../../domain/repositories/ITeamRepository';
import type { ITeamMembershipRepository } from '../../domain/repositories/ITeamMembershipRepository';
import type {
GetTeamDetailsQueryParamsDTO,
GetTeamDetailsQueryResultDTO,
} from '../dto/TeamCommandAndQueryDTO';
import type { ITeamDetailsPresenter } from '../presenters/ITeamDetailsPresenter';
export class GetTeamDetailsQuery {
/**
* 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(params: GetTeamDetailsQueryParamsDTO): Promise<GetTeamDetailsQueryResultDTO> {
const { teamId, driverId } = params;
async execute(teamId: string, driverId: string): Promise<void> {
const team = await this.teamRepository.findById(teamId);
if (!team) {
throw new Error('Team not found');
@@ -21,6 +21,6 @@ export class GetTeamDetailsQuery {
const membership = await this.membershipRepository.getMembership(teamId, driverId);
return { team, membership };
this.presenter.present(team, membership, driverId);
}
}