refactor dtos to ports

This commit is contained in:
2025-12-19 14:08:27 +01:00
parent 2ab86ec9bd
commit 499562c456
106 changed files with 386 additions and 1009 deletions

View File

@@ -0,0 +1,8 @@
export interface AcceptSponsorshipOutputPort {
requestId: string;
sponsorshipId: string;
status: 'accepted';
acceptedAt: Date;
platformFee: number;
netAmount: number;
}

View File

@@ -0,0 +1,5 @@
export interface ApplyForSponsorshipResultPort {
requestId: string;
status: 'pending';
createdAt: Date;
}

View File

@@ -0,0 +1,4 @@
export interface ApproveLeagueJoinRequestResultPort {
success: boolean;
message: string;
}

View File

@@ -0,0 +1,8 @@
import type { ChampionshipStandingsRowOutputPort } from './ChampionshipStandingsRowOutputPort';
export interface ChampionshipStandingsOutputPort {
seasonId: string;
championshipId: string;
championshipName: string;
rows: ChampionshipStandingsRowOutputPort[];
}

View File

@@ -0,0 +1,9 @@
import type { ParticipantRef } from '@core/racing/domain/types/ParticipantRef';
export interface ChampionshipStandingsRowOutputPort {
participant: ParticipantRef;
position: number;
totalPoints: number;
resultsCounted: number;
resultsDropped: number;
}

View File

@@ -0,0 +1,6 @@
export interface CreateLeagueWithSeasonAndScoringOutputPort {
leagueId: string;
seasonId: string;
scoringPresetId?: string;
scoringPresetName?: string;
}

View File

@@ -0,0 +1,10 @@
export interface CreateSponsorOutputPort {
sponsor: {
id: string;
name: string;
contactEmail: string;
websiteUrl?: string;
logoUrl?: string;
createdAt: Date;
};
}

View File

@@ -0,0 +1,5 @@
import type { Team } from '../../../domain/entities/Team';
export interface CreateTeamOutputPort {
team: Team;
}

View File

@@ -0,0 +1,8 @@
export interface DriverOutputPort {
id: string;
iracingId: string;
name: string;
country: string;
bio?: string;
joinedAt: string;
}

View File

@@ -0,0 +1,3 @@
import type { Team } from '../../../domain/entities/Team';
export type GetAllTeamsOutputPort = Team[];

View File

@@ -0,0 +1,3 @@
export interface GetDriverAvatarOutputPort {
avatarUrl: string;
}

View File

@@ -0,0 +1,4 @@
export interface GetDriverRatingOutputPort {
rating: number | null;
ratingChange: number | null;
}

View File

@@ -0,0 +1,7 @@
import type { Team } from '../../../domain/entities/Team';
import type { TeamMembership } from '../../../domain/types/TeamMembership';
export interface GetDriverTeamOutputPort {
team: Team;
membership: TeamMembership;
}

View File

@@ -0,0 +1,11 @@
import type { SponsorableEntityType } from '../../../domain/entities/SponsorshipRequest';
import type { SponsorshipSlotDTO } from './SponsorshipSlotOutputPort';
export interface GetEntitySponsorshipPricingOutputPort {
entityType: SponsorableEntityType;
entityId: string;
acceptingApplications: boolean;
customRequirements?: string;
mainSlot?: SponsorshipSlotDTO;
secondarySlot?: SponsorshipSlotDTO;
}

View File

@@ -0,0 +1,7 @@
export interface GetLeagueAdminOutputPort {
league: {
id: string;
ownerId: string;
};
// Additional data would be populated by combining multiple use cases
}

View File

@@ -0,0 +1,4 @@
export interface GetLeagueAdminPermissionsOutputPort {
canRemoveMember: boolean;
canUpdateRoles: boolean;
}

View File

@@ -0,0 +1,3 @@
export interface GetLeagueCoverOutputPort {
coverUrl: string;
}

View File

@@ -0,0 +1,13 @@
export interface GetLeagueJoinRequestsOutputPort {
joinRequests: Array<{
id: string;
leagueId: string;
driverId: string;
requestedAt: Date;
message?: string;
driver: {
id: string;
name: string;
};
}>;
}

View File

@@ -0,0 +1,3 @@
export interface GetLeagueLogoOutputPort {
logoUrl: string;
}

View File

@@ -0,0 +1,6 @@
import type { LeagueMembership } from '../../../domain/entities/LeagueMembership';
export interface GetLeagueMembershipsOutputPort {
memberships: LeagueMembership[];
drivers: { id: string; name: string }[];
}

View File

@@ -0,0 +1,3 @@
export interface GetLeagueOwnerSummaryOutputPort {
summary: { driver: { id: string; name: string }; rating: number; rank: number } | null;
}

View File

@@ -0,0 +1,18 @@
import type { ProtestOutputPort } from './ProtestOutputPort';
export interface RaceOutputPort {
id: string;
name: string;
date: string;
}
export interface DriverOutputPort {
id: string;
name: string;
}
export interface GetLeagueProtestsOutputPort {
protests: ProtestOutputPort[];
races: RaceOutputPort[];
drivers: DriverOutputPort[];
}

View File

@@ -0,0 +1,7 @@
export interface GetLeagueScheduleOutputPort {
races: Array<{
id: string;
name: string;
scheduledAt: Date;
}>;
}

View File

@@ -0,0 +1,7 @@
import type { Team } from '../../../domain/entities/Team';
import type { TeamMembership } from '../../../domain/types/TeamMembership';
export interface GetTeamDetailsOutputPort {
team: Team;
membership: TeamMembership | null;
}

View File

@@ -0,0 +1,3 @@
export interface GetTeamLogoOutputPort {
logoUrl: string;
}

View File

@@ -0,0 +1,20 @@
export interface LeagueDriverSeasonStatsOutputPort {
leagueId: string;
driverId: string;
position: number;
driverName: string;
teamId?: string;
teamName?: string;
totalPoints: number;
basePoints: number;
penaltyPoints: number;
bonusPoints: number;
pointsPerRace: number;
racesStarted: number;
racesFinished: number;
dnfs: number;
noShows: number;
avgFinish: number | null;
rating: number | null;
ratingChange: number | null;
}

View File

@@ -0,0 +1,20 @@
export interface LeagueOutputPort {
id: string;
name: string;
description: string;
ownerId: string;
settings: {
pointsSystem: 'f1-2024' | 'indycar' | 'custom';
sessionDuration?: number;
qualifyingFormat?: 'single-lap' | 'open';
customPoints?: Record<number, number>;
maxDrivers?: number;
};
createdAt: string;
socialLinks?: {
discordUrl?: string;
youtubeUrl?: string;
websiteUrl?: string;
};
usedSlots?: number;
}

View File

@@ -0,0 +1,18 @@
import type { Weekday } from '../../../domain/types/Weekday';
export interface LeagueScheduleOutputPort {
seasonStartDate: string;
raceStartTime: string;
timezoneId: string;
recurrenceStrategy: 'weekly' | 'everyNWeeks' | 'monthlyNthWeekday';
intervalWeeks?: number;
weekdays?: Weekday[];
monthlyOrdinal?: 1 | 2 | 3 | 4;
monthlyWeekday?: Weekday;
plannedRounds: number;
}
export interface LeagueSchedulePreviewOutputPort {
rounds: Array<{ roundNumber: number; scheduledAt: string; timezoneId: string }>;
summary: string;
}

View File

@@ -0,0 +1,20 @@
export interface LeagueScoringChampionshipOutputPort {
id: string;
name: string;
type: 'driver' | 'team' | 'nations' | 'trophy';
sessionTypes: string[];
pointsPreview: Array<{ sessionType: string; position: number; points: number }>;
bonusSummary: string[];
dropPolicyDescription: string;
}
export interface LeagueScoringConfigOutputPort {
leagueId: string;
seasonId: string;
gameId: string;
gameName: string;
scoringPresetId?: string;
scoringPresetName?: string;
dropPolicySummary: string;
championships: LeagueScoringChampionshipOutputPort[];
}

View File

@@ -0,0 +1,15 @@
export type LeagueScoringPresetPrimaryChampionshipType =
| 'driver'
| 'team'
| 'nations'
| 'trophy';
export interface LeagueScoringPresetOutputPort {
id: string;
name: string;
description: string;
primaryChampionshipType: LeagueScoringPresetPrimaryChampionshipType;
sessionSummary: string;
bonusSummary: string;
dropPolicySummary: string;
}

View File

@@ -0,0 +1,25 @@
export interface LeagueSummaryScoringOutputPort {
gameId: string;
gameName: string;
primaryChampionshipType: 'driver' | 'team' | 'nations' | 'trophy';
scoringPresetId: string;
scoringPresetName: string;
dropPolicySummary: string;
scoringPatternSummary: string;
}
export interface LeagueSummaryOutputPort {
id: string;
name: string;
description?: string;
createdAt: Date;
ownerId: string;
maxDrivers?: number;
usedDriverSlots?: number;
maxTeams?: number;
usedTeamSlots?: number;
structureSummary?: string;
scoringPatternSummary?: string;
timingSummary?: string;
scoring?: LeagueSummaryScoringOutputPort;
}

View File

@@ -0,0 +1,6 @@
export interface ProcessPaymentOutputPort {
success: boolean;
transactionId?: string;
error?: string;
timestamp: Date;
}

View File

@@ -0,0 +1,9 @@
export interface ProtestOutputPort {
id: string;
raceId: string;
protestingDriverId: string;
accusedDriverId: string;
submittedAt: Date;
description: string;
status: string;
}

View File

@@ -0,0 +1,14 @@
export interface RaceOutputPort {
id: string;
leagueId: string;
scheduledAt: string;
track: string;
trackId?: string;
car: string;
carId?: string;
sessionType: 'practice' | 'qualifying' | 'race';
status: 'scheduled' | 'running' | 'completed' | 'cancelled';
strengthOfField?: number;
registeredCount?: number;
maxParticipants?: number;
}

View File

@@ -0,0 +1,6 @@
export interface RefundPaymentOutputPort {
success: boolean;
refundId?: string;
error?: string;
timestamp: Date;
}

View File

@@ -0,0 +1,9 @@
export interface ResultOutputPort {
id: string;
raceId: string;
driverId: string;
position: number;
fastestLap: number;
incidents: number;
startPosition: number;
}

View File

@@ -0,0 +1,13 @@
import type { SponsorshipTier } from '../../../domain/entities/SeasonSponsorship';
export interface SponsorshipSlotOutputPort {
tier: SponsorshipTier;
price: number;
currency: string;
formattedPrice: string;
benefits: string[];
available: boolean;
maxSlots: number;
filledSlots: number;
pendingRequests: number;
}

View File

@@ -0,0 +1,8 @@
export interface StandingOutputPort {
leagueId: string;
driverId: string;
points: number;
wins: number;
position: number;
racesCompleted: number;
}

View File

@@ -0,0 +1,6 @@
export interface VerifyPaymentOutputPort {
success: boolean;
transactionId?: string;
error?: string;
timestamp: Date;
}