rename to core

This commit is contained in:
2025-12-15 13:46:07 +01:00
parent aedf58643d
commit 5c22f8820c
559 changed files with 415 additions and 767 deletions

View File

@@ -0,0 +1,20 @@
/**
* Application Port: DriverRatingProvider
*
* Port for looking up driver ratings.
* Implemented by infrastructure adapters that connect to rating systems.
*/
export interface DriverRatingProvider {
/**
* Get the rating for a single driver
* Returns null if driver has no rating
*/
getRating(driverId: string): number | null;
/**
* Get ratings for multiple drivers
* Returns a map of driverId -> rating
*/
getRatings(driverIds: string[]): Map<string, number>;
}

View File

@@ -0,0 +1,12 @@
/**
* Application Port: IImageServicePort
*
* Abstraction used by racing application use cases to obtain image URLs
* for drivers, teams and leagues without depending on UI/media layers.
*/
export interface IImageServicePort {
getDriverAvatar(driverId: string): string;
getTeamLogo(teamId: string): string;
getLeagueCover(leagueId: string): string;
getLeagueLogo(leagueId: string): string;
}

View File

@@ -0,0 +1,46 @@
/**
* Application Port: ILiveryCompositor
*
* Defines interface for livery image composition.
* Infrastructure will provide image processing implementation.
*/
import type { LiveryDecal } from '../../domain/value-objects/LiveryDecal';
export interface CompositionResult {
success: boolean;
composedImageUrl?: string;
error?: string;
timestamp: Date;
}
export interface ILiveryCompositor {
/**
* Composite a livery by layering decals on base image
*/
composeLivery(
baseImageUrl: string,
decals: LiveryDecal[]
): Promise<CompositionResult>;
/**
* Generate a livery pack (.zip) for all drivers in a season
*/
generateLiveryPack(
seasonId: string,
liveryData: Array<{
driverId: string;
driverName: string;
carId: string;
composedImageUrl: string;
}>
): Promise<Buffer>;
/**
* Validate livery image (check for logos/text)
*/
validateLiveryImage(imageUrl: string): Promise<{
isValid: boolean;
violations?: string[];
}>;
}

View File

@@ -0,0 +1,39 @@
/**
* Application Port: ILiveryStorage
*
* Defines interface for livery image storage.
* Infrastructure will provide cloud storage adapter.
*/
export interface UploadResult {
success: boolean;
imageUrl?: string;
error?: string;
timestamp: Date;
}
export interface ILiveryStorage {
/**
* Upload a livery image
*/
upload(
imageData: Buffer | string,
fileName: string,
metadata?: Record<string, unknown>
): Promise<UploadResult>;
/**
* Download a livery image
*/
download(imageUrl: string): Promise<Buffer>;
/**
* Delete a livery image
*/
delete(imageUrl: string): Promise<void>;
/**
* Generate a signed URL for temporary access
*/
generateSignedUrl(imageUrl: string, expiresInSeconds: number): Promise<string>;
}

View File

@@ -0,0 +1,48 @@
/**
* Application Port: IPaymentGateway
*
* Defines interface for payment processing.
* Infrastructure will provide mock or real implementation.
*/
import type { Money } from '../../domain/value-objects/Money';
export interface PaymentResult {
success: boolean;
transactionId?: string;
error?: string;
timestamp: Date;
}
export interface RefundResult {
success: boolean;
refundId?: string;
error?: string;
timestamp: Date;
}
export interface IPaymentGateway {
/**
* Process a payment
*/
processPayment(
amount: Money,
payerId: string,
description: string,
metadata?: Record<string, unknown>
): Promise<PaymentResult>;
/**
* Refund a payment
*/
refund(
originalTransactionId: string,
amount: Money,
reason: string
): Promise<RefundResult>;
/**
* Verify payment status
*/
verifyPayment(transactionId: string): Promise<PaymentResult>;
}

View File

@@ -0,0 +1,26 @@
export type LeagueScoringPresetPrimaryChampionshipType =
| 'driver'
| 'team'
| 'nations'
| 'trophy';
export interface LeagueScoringPresetDTO {
id: string;
name: string;
description: string;
primaryChampionshipType: LeagueScoringPresetPrimaryChampionshipType;
sessionSummary: string;
bonusSummary: string;
dropPolicySummary: string;
}
/**
* Provider abstraction for league scoring presets used by application-layer queries.
*
* In-memory implementation is backed by the preset registry in
* InMemoryScoringRepositories.
*/
export interface LeagueScoringPresetProvider {
listPresets(): LeagueScoringPresetDTO[];
getPresetById(id: string): LeagueScoringPresetDTO | undefined;
}