From 2ab86ec9bd991c2ef7e79ddd6b3d7a2f3ffcea62 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Fri, 19 Dec 2025 13:07:38 +0100 Subject: [PATCH] refactor dtos to ports --- .../ApproveLeagueJoinRequestUseCaseParams.ts | 4 ---- .../dtos/ApproveTeamJoinRequestCommandDTO.ts | 4 ---- .../application/dtos/CancelRaceCommandDTO.ts | 3 --- .../application/dtos/CompleteRaceCommandDTO.ts | 3 --- .../application/dtos/DashboardOverviewParams.ts | 3 --- .../dtos/GetDriverTeamQueryParamsDTO.ts | 3 --- .../dtos/GetLeagueJoinRequestsUseCaseParams.ts | 3 --- .../dtos/GetTeamDetailsQueryParamsDTO.ts | 4 ---- .../dtos/GetTeamJoinRequestsQueryParamsDTO.ts | 3 --- .../dtos/GetTeamMembersQueryParamsDTO.ts | 3 --- .../application/dtos/LeagueConfigFormDTO.ts | 4 +++- .../dtos/RejectTeamJoinRequestCommandDTO.ts | 3 --- .../dtos/WithdrawFromRaceCommandDTO.ts | 4 ---- .../input/AcceptSponsorshipInputPort.ts} | 2 +- .../input/ApproveLeagueJoinRequestInputPort.ts | 4 ++++ .../input/ApproveTeamJoinRequestInputPort.ts | 4 ++++ .../ports/input/CancelRaceInputPort.ts | 3 +++ .../input/CloseRaceEventStewardingInputPort.ts} | 2 +- .../input/CompleteDriverOnboardingInputPort.ts} | 2 +- .../ports/input/CompleteRaceInputPort.ts | 3 +++ ...CreateLeagueWithSeasonAndScoringInputPort.ts} | 4 ++-- .../input/CreateSponsorInputPort.ts} | 2 +- .../input/CreateTeamInputPort.ts} | 2 +- .../ports/input/DashboardOverviewInputPort.ts | 3 +++ .../ports/input/DriverTeamInputPort.ts | 3 +++ .../input/FileProtestInputPort.ts} | 4 ++-- .../input/JoinLeagueInputPort.ts} | 2 +- .../input/JoinTeamInputPort.ts} | 2 +- .../ports/input/LeagueJoinRequestsInputPort.ts | 3 +++ .../input/LeaveTeamInputPort.ts} | 2 +- .../input/RegisterForRaceInputPort.ts} | 2 +- .../input/RejectTeamJoinRequestInputPort.ts | 3 +++ .../ports/input/TeamDetailsInputPort.ts | 4 ++++ .../ports/input/TeamJoinRequestsInputPort.ts | 3 +++ .../ports/input/TeamMembersInputPort.ts | 3 +++ .../input/UpdateTeamInputPort.ts} | 4 ++-- .../ports/input/WithdrawFromRaceInputPort.ts | 4 ++++ .../use-cases/ApproveTeamJoinRequestUseCase.ts | 16 ++++++++-------- .../application/use-cases/JoinTeamUseCase.ts | 14 +++++++------- .../application/use-cases/LeaveTeamUseCase.ts | 8 ++++---- .../use-cases/RejectTeamJoinRequestUseCase.ts | 6 +++--- .../application/use-cases/UpdateTeamUseCase.ts | 6 +++--- 42 files changed, 83 insertions(+), 81 deletions(-) delete mode 100644 core/racing/application/dtos/ApproveLeagueJoinRequestUseCaseParams.ts delete mode 100644 core/racing/application/dtos/ApproveTeamJoinRequestCommandDTO.ts delete mode 100644 core/racing/application/dtos/CancelRaceCommandDTO.ts delete mode 100644 core/racing/application/dtos/CompleteRaceCommandDTO.ts delete mode 100644 core/racing/application/dtos/DashboardOverviewParams.ts delete mode 100644 core/racing/application/dtos/GetDriverTeamQueryParamsDTO.ts delete mode 100644 core/racing/application/dtos/GetLeagueJoinRequestsUseCaseParams.ts delete mode 100644 core/racing/application/dtos/GetTeamDetailsQueryParamsDTO.ts delete mode 100644 core/racing/application/dtos/GetTeamJoinRequestsQueryParamsDTO.ts delete mode 100644 core/racing/application/dtos/GetTeamMembersQueryParamsDTO.ts delete mode 100644 core/racing/application/dtos/RejectTeamJoinRequestCommandDTO.ts delete mode 100644 core/racing/application/dtos/WithdrawFromRaceCommandDTO.ts rename core/racing/application/{dtos/AcceptSponsorshipRequestDTO.ts => ports/input/AcceptSponsorshipInputPort.ts} (63%) create mode 100644 core/racing/application/ports/input/ApproveLeagueJoinRequestInputPort.ts create mode 100644 core/racing/application/ports/input/ApproveTeamJoinRequestInputPort.ts create mode 100644 core/racing/application/ports/input/CancelRaceInputPort.ts rename core/racing/application/{dtos/CloseRaceEventStewardingCommand.ts => ports/input/CloseRaceEventStewardingInputPort.ts} (83%) rename core/racing/application/{dtos/CompleteDriverOnboardingCommand.ts => ports/input/CompleteDriverOnboardingInputPort.ts} (72%) create mode 100644 core/racing/application/ports/input/CompleteRaceInputPort.ts rename core/racing/application/{dtos/CreateLeagueWithSeasonAndScoringCommand.ts => ports/input/CreateLeagueWithSeasonAndScoringInputPort.ts} (80%) rename core/racing/application/{dtos/CreateSponsorCommand.ts => ports/input/CreateSponsorInputPort.ts} (66%) rename core/racing/application/{dtos/CreateTeamCommandDTO.ts => ports/input/CreateTeamInputPort.ts} (70%) create mode 100644 core/racing/application/ports/input/DashboardOverviewInputPort.ts create mode 100644 core/racing/application/ports/input/DriverTeamInputPort.ts rename core/racing/application/{dtos/FileProtestCommand.ts => ports/input/FileProtestInputPort.ts} (56%) rename core/racing/application/{dtos/JoinLeagueCommandDTO.ts => ports/input/JoinLeagueInputPort.ts} (50%) rename core/racing/application/{dtos/JoinTeamCommandDTO.ts => ports/input/JoinTeamInputPort.ts} (50%) create mode 100644 core/racing/application/ports/input/LeagueJoinRequestsInputPort.ts rename core/racing/application/{dtos/LeaveTeamCommandDTO.ts => ports/input/LeaveTeamInputPort.ts} (50%) rename core/racing/application/{dtos/RegisterForRaceCommandDTO.ts => ports/input/RegisterForRaceInputPort.ts} (56%) create mode 100644 core/racing/application/ports/input/RejectTeamJoinRequestInputPort.ts create mode 100644 core/racing/application/ports/input/TeamDetailsInputPort.ts create mode 100644 core/racing/application/ports/input/TeamJoinRequestsInputPort.ts create mode 100644 core/racing/application/ports/input/TeamMembersInputPort.ts rename core/racing/application/{dtos/UpdateTeamCommandDTO.ts => ports/input/UpdateTeamInputPort.ts} (54%) create mode 100644 core/racing/application/ports/input/WithdrawFromRaceInputPort.ts diff --git a/core/racing/application/dtos/ApproveLeagueJoinRequestUseCaseParams.ts b/core/racing/application/dtos/ApproveLeagueJoinRequestUseCaseParams.ts deleted file mode 100644 index 9f4b7b860..000000000 --- a/core/racing/application/dtos/ApproveLeagueJoinRequestUseCaseParams.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface ApproveLeagueJoinRequestUseCaseParams { - leagueId: string; - requestId: string; -} \ No newline at end of file diff --git a/core/racing/application/dtos/ApproveTeamJoinRequestCommandDTO.ts b/core/racing/application/dtos/ApproveTeamJoinRequestCommandDTO.ts deleted file mode 100644 index af6b2c2c2..000000000 --- a/core/racing/application/dtos/ApproveTeamJoinRequestCommandDTO.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface ApproveTeamJoinRequestCommandDTO { - teamId: string; - requestId: string; -} \ No newline at end of file diff --git a/core/racing/application/dtos/CancelRaceCommandDTO.ts b/core/racing/application/dtos/CancelRaceCommandDTO.ts deleted file mode 100644 index b6e36d0dc..000000000 --- a/core/racing/application/dtos/CancelRaceCommandDTO.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface CancelRaceCommandDTO { - raceId: string; -} \ No newline at end of file diff --git a/core/racing/application/dtos/CompleteRaceCommandDTO.ts b/core/racing/application/dtos/CompleteRaceCommandDTO.ts deleted file mode 100644 index befa17f45..000000000 --- a/core/racing/application/dtos/CompleteRaceCommandDTO.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface CompleteRaceCommandDTO { - raceId: string; -} \ No newline at end of file diff --git a/core/racing/application/dtos/DashboardOverviewParams.ts b/core/racing/application/dtos/DashboardOverviewParams.ts deleted file mode 100644 index ea0ce703f..000000000 --- a/core/racing/application/dtos/DashboardOverviewParams.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface DashboardOverviewParams { - driverId: string; -} \ No newline at end of file diff --git a/core/racing/application/dtos/GetDriverTeamQueryParamsDTO.ts b/core/racing/application/dtos/GetDriverTeamQueryParamsDTO.ts deleted file mode 100644 index e794a2ca4..000000000 --- a/core/racing/application/dtos/GetDriverTeamQueryParamsDTO.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface GetDriverTeamQueryParamsDTO { - driverId: string; -} \ No newline at end of file diff --git a/core/racing/application/dtos/GetLeagueJoinRequestsUseCaseParams.ts b/core/racing/application/dtos/GetLeagueJoinRequestsUseCaseParams.ts deleted file mode 100644 index c93aa9679..000000000 --- a/core/racing/application/dtos/GetLeagueJoinRequestsUseCaseParams.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface GetLeagueJoinRequestsUseCaseParams { - leagueId: string; -} \ No newline at end of file diff --git a/core/racing/application/dtos/GetTeamDetailsQueryParamsDTO.ts b/core/racing/application/dtos/GetTeamDetailsQueryParamsDTO.ts deleted file mode 100644 index f59c26568..000000000 --- a/core/racing/application/dtos/GetTeamDetailsQueryParamsDTO.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface GetTeamDetailsQueryParamsDTO { - teamId: string; - driverId: string; -} \ No newline at end of file diff --git a/core/racing/application/dtos/GetTeamJoinRequestsQueryParamsDTO.ts b/core/racing/application/dtos/GetTeamJoinRequestsQueryParamsDTO.ts deleted file mode 100644 index 0e77992e5..000000000 --- a/core/racing/application/dtos/GetTeamJoinRequestsQueryParamsDTO.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface GetTeamJoinRequestsQueryParamsDTO { - teamId: string; -} \ No newline at end of file diff --git a/core/racing/application/dtos/GetTeamMembersQueryParamsDTO.ts b/core/racing/application/dtos/GetTeamMembersQueryParamsDTO.ts deleted file mode 100644 index 3b57da6e4..000000000 --- a/core/racing/application/dtos/GetTeamMembersQueryParamsDTO.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface GetTeamMembersQueryParamsDTO { - teamId: string; -} \ No newline at end of file diff --git a/core/racing/application/dtos/LeagueConfigFormDTO.ts b/core/racing/application/dtos/LeagueConfigFormDTO.ts index 0b9cc5a81..bfd975697 100644 --- a/core/racing/application/dtos/LeagueConfigFormDTO.ts +++ b/core/racing/application/dtos/LeagueConfigFormDTO.ts @@ -1,8 +1,10 @@ -import type { LeagueVisibilityType } from '../../domain/value-objects/LeagueVisibility'; import type { StewardingDecisionMode } from '../../domain/entities/League'; +import type { LeagueVisibilityType } from '../../domain/value-objects/LeagueVisibility'; export type LeagueStructureMode = 'solo' | 'fixedTeams'; +// TODO this is way too much for a DTO. it must be pure InputPort or OutputPort + /** * League visibility determines public visibility and ranking status. * - 'ranked': Public, competitive, affects driver ratings. Requires min 10 drivers. diff --git a/core/racing/application/dtos/RejectTeamJoinRequestCommandDTO.ts b/core/racing/application/dtos/RejectTeamJoinRequestCommandDTO.ts deleted file mode 100644 index 7bc80ced1..000000000 --- a/core/racing/application/dtos/RejectTeamJoinRequestCommandDTO.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface RejectTeamJoinRequestCommandDTO { - requestId: string; -} \ No newline at end of file diff --git a/core/racing/application/dtos/WithdrawFromRaceCommandDTO.ts b/core/racing/application/dtos/WithdrawFromRaceCommandDTO.ts deleted file mode 100644 index 78a10dfe2..000000000 --- a/core/racing/application/dtos/WithdrawFromRaceCommandDTO.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface WithdrawFromRaceCommandDTO { - raceId: string; - driverId: string; -} \ No newline at end of file diff --git a/core/racing/application/dtos/AcceptSponsorshipRequestDTO.ts b/core/racing/application/ports/input/AcceptSponsorshipInputPort.ts similarity index 63% rename from core/racing/application/dtos/AcceptSponsorshipRequestDTO.ts rename to core/racing/application/ports/input/AcceptSponsorshipInputPort.ts index 1f4e9095f..07fc2ea24 100644 --- a/core/racing/application/dtos/AcceptSponsorshipRequestDTO.ts +++ b/core/racing/application/ports/input/AcceptSponsorshipInputPort.ts @@ -1,4 +1,4 @@ -export interface AcceptSponsorshipRequestDTO { +export interface AcceptSponsorshipInputPort { requestId: string; respondedBy: string; // driverId of the person accepting } \ No newline at end of file diff --git a/core/racing/application/ports/input/ApproveLeagueJoinRequestInputPort.ts b/core/racing/application/ports/input/ApproveLeagueJoinRequestInputPort.ts new file mode 100644 index 000000000..467aa6310 --- /dev/null +++ b/core/racing/application/ports/input/ApproveLeagueJoinRequestInputPort.ts @@ -0,0 +1,4 @@ +export interface ApproveLeagueJoinRequestInputPort { + leagueId: string; + requestId: string; +} \ No newline at end of file diff --git a/core/racing/application/ports/input/ApproveTeamJoinRequestInputPort.ts b/core/racing/application/ports/input/ApproveTeamJoinRequestInputPort.ts new file mode 100644 index 000000000..29fe30fe3 --- /dev/null +++ b/core/racing/application/ports/input/ApproveTeamJoinRequestInputPort.ts @@ -0,0 +1,4 @@ +export interface ApproveTeamJoinRequestInputPort { + teamId: string; + requestId: string; +} \ No newline at end of file diff --git a/core/racing/application/ports/input/CancelRaceInputPort.ts b/core/racing/application/ports/input/CancelRaceInputPort.ts new file mode 100644 index 000000000..90a41eb35 --- /dev/null +++ b/core/racing/application/ports/input/CancelRaceInputPort.ts @@ -0,0 +1,3 @@ +export interface CancelRaceInputPort { + raceId: string; +} \ No newline at end of file diff --git a/core/racing/application/dtos/CloseRaceEventStewardingCommand.ts b/core/racing/application/ports/input/CloseRaceEventStewardingInputPort.ts similarity index 83% rename from core/racing/application/dtos/CloseRaceEventStewardingCommand.ts rename to core/racing/application/ports/input/CloseRaceEventStewardingInputPort.ts index e0ea67e48..51365537c 100644 --- a/core/racing/application/dtos/CloseRaceEventStewardingCommand.ts +++ b/core/racing/application/ports/input/CloseRaceEventStewardingInputPort.ts @@ -4,6 +4,6 @@ * Scheduled job that checks for race events with expired stewarding windows * and closes them, triggering final results notifications. */ -export interface CloseRaceEventStewardingCommand { +export interface CloseRaceEventStewardingInputPort { // No parameters needed - finds all expired events automatically } \ No newline at end of file diff --git a/core/racing/application/dtos/CompleteDriverOnboardingCommand.ts b/core/racing/application/ports/input/CompleteDriverOnboardingInputPort.ts similarity index 72% rename from core/racing/application/dtos/CompleteDriverOnboardingCommand.ts rename to core/racing/application/ports/input/CompleteDriverOnboardingInputPort.ts index c8ea76294..8db977849 100644 --- a/core/racing/application/dtos/CompleteDriverOnboardingCommand.ts +++ b/core/racing/application/ports/input/CompleteDriverOnboardingInputPort.ts @@ -1,4 +1,4 @@ -export interface CompleteDriverOnboardingCommand { +export interface CompleteDriverOnboardingInputPort { userId: string; firstName: string; lastName: string; diff --git a/core/racing/application/ports/input/CompleteRaceInputPort.ts b/core/racing/application/ports/input/CompleteRaceInputPort.ts new file mode 100644 index 000000000..7f6a6e947 --- /dev/null +++ b/core/racing/application/ports/input/CompleteRaceInputPort.ts @@ -0,0 +1,3 @@ +export interface CompleteRaceInputPort { + raceId: string; +} \ No newline at end of file diff --git a/core/racing/application/dtos/CreateLeagueWithSeasonAndScoringCommand.ts b/core/racing/application/ports/input/CreateLeagueWithSeasonAndScoringInputPort.ts similarity index 80% rename from core/racing/application/dtos/CreateLeagueWithSeasonAndScoringCommand.ts rename to core/racing/application/ports/input/CreateLeagueWithSeasonAndScoringInputPort.ts index 1d3a9cf8b..f87076bde 100644 --- a/core/racing/application/dtos/CreateLeagueWithSeasonAndScoringCommand.ts +++ b/core/racing/application/ports/input/CreateLeagueWithSeasonAndScoringInputPort.ts @@ -1,6 +1,6 @@ -import type { LeagueVisibilityInput } from './LeagueVisibilityInput'; +import type { LeagueVisibilityInput } from '../../dtos/LeagueVisibilityInput'; -export interface CreateLeagueWithSeasonAndScoringCommand { +export interface CreateLeagueWithSeasonAndScoringInputPort { name: string; description?: string; /** diff --git a/core/racing/application/dtos/CreateSponsorCommand.ts b/core/racing/application/ports/input/CreateSponsorInputPort.ts similarity index 66% rename from core/racing/application/dtos/CreateSponsorCommand.ts rename to core/racing/application/ports/input/CreateSponsorInputPort.ts index 01d9cc52c..fd281645b 100644 --- a/core/racing/application/dtos/CreateSponsorCommand.ts +++ b/core/racing/application/ports/input/CreateSponsorInputPort.ts @@ -1,4 +1,4 @@ -export interface CreateSponsorCommand { +export interface CreateSponsorInputPort { name: string; contactEmail: string; websiteUrl?: string; diff --git a/core/racing/application/dtos/CreateTeamCommandDTO.ts b/core/racing/application/ports/input/CreateTeamInputPort.ts similarity index 70% rename from core/racing/application/dtos/CreateTeamCommandDTO.ts rename to core/racing/application/ports/input/CreateTeamInputPort.ts index 90ef84315..5db10dc8a 100644 --- a/core/racing/application/dtos/CreateTeamCommandDTO.ts +++ b/core/racing/application/ports/input/CreateTeamInputPort.ts @@ -1,4 +1,4 @@ -export interface CreateTeamCommandDTO { +export interface CreateTeamInputPort { name: string; tag: string; description: string; diff --git a/core/racing/application/ports/input/DashboardOverviewInputPort.ts b/core/racing/application/ports/input/DashboardOverviewInputPort.ts new file mode 100644 index 000000000..253adbaaa --- /dev/null +++ b/core/racing/application/ports/input/DashboardOverviewInputPort.ts @@ -0,0 +1,3 @@ +export interface DashboardOverviewInputPort { + driverId: string; +} \ No newline at end of file diff --git a/core/racing/application/ports/input/DriverTeamInputPort.ts b/core/racing/application/ports/input/DriverTeamInputPort.ts new file mode 100644 index 000000000..90b3caebe --- /dev/null +++ b/core/racing/application/ports/input/DriverTeamInputPort.ts @@ -0,0 +1,3 @@ +export interface DriverTeamInputPort { + driverId: string; +} \ No newline at end of file diff --git a/core/racing/application/dtos/FileProtestCommand.ts b/core/racing/application/ports/input/FileProtestInputPort.ts similarity index 56% rename from core/racing/application/dtos/FileProtestCommand.ts rename to core/racing/application/ports/input/FileProtestInputPort.ts index 7f7616961..ae3e97c03 100644 --- a/core/racing/application/dtos/FileProtestCommand.ts +++ b/core/racing/application/ports/input/FileProtestInputPort.ts @@ -1,6 +1,6 @@ -import type { ProtestIncident } from '../../domain/entities/Protest'; +import { ProtestIncident } from "@/racing/domain/entities/ProtestIncident"; -export interface FileProtestCommand { +export interface FileProtestInputPort { raceId: string; protestingDriverId: string; accusedDriverId: string; diff --git a/core/racing/application/dtos/JoinLeagueCommandDTO.ts b/core/racing/application/ports/input/JoinLeagueInputPort.ts similarity index 50% rename from core/racing/application/dtos/JoinLeagueCommandDTO.ts rename to core/racing/application/ports/input/JoinLeagueInputPort.ts index 7075ccacd..98cc5a709 100644 --- a/core/racing/application/dtos/JoinLeagueCommandDTO.ts +++ b/core/racing/application/ports/input/JoinLeagueInputPort.ts @@ -1,4 +1,4 @@ -export interface JoinLeagueCommandDTO { +export interface JoinLeagueInputPort { leagueId: string; driverId: string; } \ No newline at end of file diff --git a/core/racing/application/dtos/JoinTeamCommandDTO.ts b/core/racing/application/ports/input/JoinTeamInputPort.ts similarity index 50% rename from core/racing/application/dtos/JoinTeamCommandDTO.ts rename to core/racing/application/ports/input/JoinTeamInputPort.ts index a6d8caf17..ff5da8455 100644 --- a/core/racing/application/dtos/JoinTeamCommandDTO.ts +++ b/core/racing/application/ports/input/JoinTeamInputPort.ts @@ -1,4 +1,4 @@ -export interface JoinTeamCommandDTO { +export interface JoinTeamInputPort { teamId: string; driverId: string; } \ No newline at end of file diff --git a/core/racing/application/ports/input/LeagueJoinRequestsInputPort.ts b/core/racing/application/ports/input/LeagueJoinRequestsInputPort.ts new file mode 100644 index 000000000..f17897b08 --- /dev/null +++ b/core/racing/application/ports/input/LeagueJoinRequestsInputPort.ts @@ -0,0 +1,3 @@ +export interface LeagueJoinRequestsInputPort { + leagueId: string; +} \ No newline at end of file diff --git a/core/racing/application/dtos/LeaveTeamCommandDTO.ts b/core/racing/application/ports/input/LeaveTeamInputPort.ts similarity index 50% rename from core/racing/application/dtos/LeaveTeamCommandDTO.ts rename to core/racing/application/ports/input/LeaveTeamInputPort.ts index 0d023140f..848b02265 100644 --- a/core/racing/application/dtos/LeaveTeamCommandDTO.ts +++ b/core/racing/application/ports/input/LeaveTeamInputPort.ts @@ -1,4 +1,4 @@ -export interface LeaveTeamCommandDTO { +export interface LeaveTeamInputPort { teamId: string; driverId: string; } \ No newline at end of file diff --git a/core/racing/application/dtos/RegisterForRaceCommandDTO.ts b/core/racing/application/ports/input/RegisterForRaceInputPort.ts similarity index 56% rename from core/racing/application/dtos/RegisterForRaceCommandDTO.ts rename to core/racing/application/ports/input/RegisterForRaceInputPort.ts index 1cadd1174..369cb9e4a 100644 --- a/core/racing/application/dtos/RegisterForRaceCommandDTO.ts +++ b/core/racing/application/ports/input/RegisterForRaceInputPort.ts @@ -1,4 +1,4 @@ -export interface RegisterForRaceCommandDTO { +export interface RegisterForRaceInputPort { raceId: string; leagueId: string; driverId: string; diff --git a/core/racing/application/ports/input/RejectTeamJoinRequestInputPort.ts b/core/racing/application/ports/input/RejectTeamJoinRequestInputPort.ts new file mode 100644 index 000000000..6339f2003 --- /dev/null +++ b/core/racing/application/ports/input/RejectTeamJoinRequestInputPort.ts @@ -0,0 +1,3 @@ +export interface RejectTeamJoinRequestInputPort { + requestId: string; +} \ No newline at end of file diff --git a/core/racing/application/ports/input/TeamDetailsInputPort.ts b/core/racing/application/ports/input/TeamDetailsInputPort.ts new file mode 100644 index 000000000..d23125957 --- /dev/null +++ b/core/racing/application/ports/input/TeamDetailsInputPort.ts @@ -0,0 +1,4 @@ +export interface TeamDetailsInputPort { + teamId: string; + driverId: string; +} \ No newline at end of file diff --git a/core/racing/application/ports/input/TeamJoinRequestsInputPort.ts b/core/racing/application/ports/input/TeamJoinRequestsInputPort.ts new file mode 100644 index 000000000..491f05b7e --- /dev/null +++ b/core/racing/application/ports/input/TeamJoinRequestsInputPort.ts @@ -0,0 +1,3 @@ +export interface TeamJoinRequestsInputPort { + teamId: string; +} \ No newline at end of file diff --git a/core/racing/application/ports/input/TeamMembersInputPort.ts b/core/racing/application/ports/input/TeamMembersInputPort.ts new file mode 100644 index 000000000..f334572e8 --- /dev/null +++ b/core/racing/application/ports/input/TeamMembersInputPort.ts @@ -0,0 +1,3 @@ +export interface TeamMembersInputPort { + teamId: string; +} \ No newline at end of file diff --git a/core/racing/application/dtos/UpdateTeamCommandDTO.ts b/core/racing/application/ports/input/UpdateTeamInputPort.ts similarity index 54% rename from core/racing/application/dtos/UpdateTeamCommandDTO.ts rename to core/racing/application/ports/input/UpdateTeamInputPort.ts index a7de39cfa..49c46ad96 100644 --- a/core/racing/application/dtos/UpdateTeamCommandDTO.ts +++ b/core/racing/application/ports/input/UpdateTeamInputPort.ts @@ -1,6 +1,6 @@ -import type { Team } from '../../domain/entities/Team'; +import type { Team } from '../../../domain/entities/Team'; -export interface UpdateTeamCommandDTO { +export interface UpdateTeamInputPort { teamId: string; updates: Partial>; updatedBy: string; diff --git a/core/racing/application/ports/input/WithdrawFromRaceInputPort.ts b/core/racing/application/ports/input/WithdrawFromRaceInputPort.ts new file mode 100644 index 000000000..1cf357ad3 --- /dev/null +++ b/core/racing/application/ports/input/WithdrawFromRaceInputPort.ts @@ -0,0 +1,4 @@ +export interface WithdrawFromRaceInputPort { + raceId: string; + driverId: string; +} \ No newline at end of file diff --git a/core/racing/application/use-cases/ApproveTeamJoinRequestUseCase.ts b/core/racing/application/use-cases/ApproveTeamJoinRequestUseCase.ts index 38da58bf4..7b31e52a5 100644 --- a/core/racing/application/use-cases/ApproveTeamJoinRequestUseCase.ts +++ b/core/racing/application/use-cases/ApproveTeamJoinRequestUseCase.ts @@ -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 { + implements AsyncUseCase { constructor( private readonly membershipRepository: ITeamMembershipRepository, ) {} - async execute(command: ApproveTeamJoinRequestCommandDTO): Promise>> { + async execute(command: ApproveTeamJoinRequestInputPort): Promise>> { const { teamId, requestId } = command; const allRequests: TeamJoinRequest[] = await this.membershipRepository.getJoinRequests(teamId); diff --git a/core/racing/application/use-cases/JoinTeamUseCase.ts b/core/racing/application/use-cases/JoinTeamUseCase.ts index a269752ba..abe28e365 100644 --- a/core/racing/application/use-cases/JoinTeamUseCase.ts +++ b/core/racing/application/use-cases/JoinTeamUseCase.ts @@ -1,27 +1,27 @@ -import type { ITeamRepository } from '../../domain/repositories/ITeamRepository'; +import type { AsyncUseCase, Logger } from '@core/shared/application'; +import { Result as SharedResult } from '@core/shared/application/Result'; +import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode'; import type { ITeamMembershipRepository } from '../../domain/repositories/ITeamMembershipRepository'; +import type { ITeamRepository } from '../../domain/repositories/ITeamRepository'; import type { TeamMembership, TeamMembershipStatus, TeamRole, } from '../../domain/types/TeamMembership'; -import type { JoinTeamCommandDTO } from '../dtos/JoinTeamCommandDTO'; -import type { AsyncUseCase, Logger } from '@core/shared/application'; -import { Result as SharedResult } from '@core/shared/application/Result'; -import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode'; +import type { JoinTeamInputPort } from '../ports/input/JoinTeamInputPort'; type JoinTeamErrorCode = 'ALREADY_IN_TEAM' | 'ALREADY_MEMBER' | 'TEAM_NOT_FOUND' | 'REPOSITORY_ERROR'; type JoinTeamApplicationError = ApplicationErrorCode; -export class JoinTeamUseCase implements AsyncUseCase { +export class JoinTeamUseCase implements AsyncUseCase { constructor( private readonly teamRepository: ITeamRepository, private readonly membershipRepository: ITeamMembershipRepository, private readonly logger: Logger, ) {} - async execute(command: JoinTeamCommandDTO): Promise> { + async execute(command: JoinTeamInputPort): Promise> { this.logger.debug('Attempting to join team', { command }); const { teamId, driverId } = command; diff --git a/core/racing/application/use-cases/LeaveTeamUseCase.ts b/core/racing/application/use-cases/LeaveTeamUseCase.ts index 99518b0b2..d4dd37980 100644 --- a/core/racing/application/use-cases/LeaveTeamUseCase.ts +++ b/core/racing/application/use-cases/LeaveTeamUseCase.ts @@ -1,20 +1,20 @@ -import type { ITeamMembershipRepository } from '../../domain/repositories/ITeamMembershipRepository'; -import type { LeaveTeamCommandDTO } from '../dtos/LeaveTeamCommandDTO'; import type { AsyncUseCase, Logger } from '@core/shared/application'; import { Result as SharedResult } from '@core/shared/application/Result'; import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode'; +import type { ITeamMembershipRepository } from '../../domain/repositories/ITeamMembershipRepository'; +import type { LeaveTeamInputPort } from '../ports/input/LeaveTeamInputPort'; type LeaveTeamErrorCode = 'NOT_MEMBER' | 'OWNER_CANNOT_LEAVE' | 'REPOSITORY_ERROR'; type LeaveTeamApplicationError = ApplicationErrorCode; -export class LeaveTeamUseCase implements AsyncUseCase { +export class LeaveTeamUseCase implements AsyncUseCase { constructor( private readonly membershipRepository: ITeamMembershipRepository, private readonly logger: Logger, ) {} - async execute(command: LeaveTeamCommandDTO): Promise> { + async execute(command: LeaveTeamInputPort): Promise> { this.logger.debug('Attempting to leave team', { command }); const { teamId, driverId } = command; diff --git a/core/racing/application/use-cases/RejectTeamJoinRequestUseCase.ts b/core/racing/application/use-cases/RejectTeamJoinRequestUseCase.ts index ba135fed2..70c812053 100644 --- a/core/racing/application/use-cases/RejectTeamJoinRequestUseCase.ts +++ b/core/racing/application/use-cases/RejectTeamJoinRequestUseCase.ts @@ -1,14 +1,14 @@ -import type { ITeamMembershipRepository } from '../../domain/repositories/ITeamMembershipRepository'; -import type { RejectTeamJoinRequestCommandDTO } from '../dtos/RejectTeamJoinRequestCommandDTO'; import { Result } from '@core/shared/application/Result'; import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode'; +import type { ITeamMembershipRepository } from '../../domain/repositories/ITeamMembershipRepository'; +import type { RejectTeamJoinRequestInputPort } from '../ports/input/RejectTeamJoinRequestInputPort'; export class RejectTeamJoinRequestUseCase { constructor( private readonly membershipRepository: ITeamMembershipRepository, ) {} - async execute(command: RejectTeamJoinRequestCommandDTO): Promise>> { + async execute(command: RejectTeamJoinRequestInputPort): Promise>> { const { requestId } = command; await this.membershipRepository.removeJoinRequest(requestId); return Result.ok(undefined); diff --git a/core/racing/application/use-cases/UpdateTeamUseCase.ts b/core/racing/application/use-cases/UpdateTeamUseCase.ts index e5064ab1a..ab9e6225e 100644 --- a/core/racing/application/use-cases/UpdateTeamUseCase.ts +++ b/core/racing/application/use-cases/UpdateTeamUseCase.ts @@ -1,9 +1,9 @@ import { Result } from '@core/shared/application/Result'; import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode'; -import type { ITeamRepository } from '../../domain/repositories/ITeamRepository'; import type { ITeamMembershipRepository } from '../../domain/repositories/ITeamMembershipRepository'; +import type { ITeamRepository } from '../../domain/repositories/ITeamRepository'; -import type { UpdateTeamCommandDTO } from '../dtos/UpdateTeamCommandDTO'; +import type { UpdateTeamInputPort } from '../ports/input/UpdateTeamInputPort'; type UpdateTeamErrorCode = 'INSUFFICIENT_PERMISSIONS' | 'TEAM_NOT_FOUND'; @@ -13,7 +13,7 @@ export class UpdateTeamUseCase { private readonly membershipRepository: ITeamMembershipRepository, ) {} - async execute(command: UpdateTeamCommandDTO): Promise>> { + async execute(command: UpdateTeamInputPort): Promise>> { const { teamId, updates, updatedBy } = command; const updaterMembership = await this.membershipRepository.getMembership(teamId, updatedBy);