refactor dtos to ports

This commit is contained in:
2025-12-19 13:07:38 +01:00
parent 08ec2af5bf
commit 2ab86ec9bd
42 changed files with 83 additions and 81 deletions

View File

@@ -1,20 +1,20 @@
import type { ITeamMembershipRepository } from '../../domain/repositories/ITeamMembershipRepository';
import type {
TeamMembership,
TeamJoinRequest,
} from '../../domain/types/TeamMembership';
import type { ApproveTeamJoinRequestCommandDTO } from '../dtos/ApproveTeamJoinRequestCommandDTO';
import type { AsyncUseCase } from '@core/shared/application';
import { Result } from '@core/shared/application/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
import type { ITeamMembershipRepository } from '../../domain/repositories/ITeamMembershipRepository';
import type {
TeamJoinRequest,
TeamMembership,
} from '../../domain/types/TeamMembership';
import type { ApproveTeamJoinRequestInputPort } from '../ports/input/ApproveTeamJoinRequestInputPort';
export class ApproveTeamJoinRequestUseCase
implements AsyncUseCase<ApproveTeamJoinRequestCommandDTO, void, string> {
implements AsyncUseCase<ApproveTeamJoinRequestInputPort, void, string> {
constructor(
private readonly membershipRepository: ITeamMembershipRepository,
) {}
async execute(command: ApproveTeamJoinRequestCommandDTO): Promise<Result<void, ApplicationErrorCode<string>>> {
async execute(command: ApproveTeamJoinRequestInputPort): Promise<Result<void, ApplicationErrorCode<string>>> {
const { teamId, requestId } = command;
const allRequests: TeamJoinRequest[] = await this.membershipRepository.getJoinRequests(teamId);