This commit is contained in:
2025-12-09 10:32:59 +01:00
parent 35f988f885
commit a780139692
26 changed files with 2224 additions and 344 deletions

View File

@@ -1,25 +1,54 @@
/**
* Application Port: IPenaltyRepository
*
* Repository interface for season-long penalties and bonuses applied
* to drivers within a league. This is intentionally simple for the
* alpha demo and operates purely on in-memory data.
* Repository Interface: IPenaltyRepository
*
* Defines the contract for persisting and retrieving Penalty entities.
*/
import type { Penalty } from '../entities/Penalty';
export interface IPenaltyRepository {
/**
* Get all penalties for a given league.
* Find a penalty by ID
*/
findByLeagueId(leagueId: string): Promise<Penalty[]>;
findById(id: string): Promise<Penalty | null>;
/**
* Get all penalties for a driver in a specific league.
* Find all penalties for a race
*/
findByLeagueIdAndDriverId(leagueId: string, driverId: string): Promise<Penalty[]>;
findByRaceId(raceId: string): Promise<Penalty[]>;
/**
* Get all penalties in the system.
* Find all penalties for a specific driver
*/
findAll(): Promise<Penalty[]>;
findByDriverId(driverId: string): Promise<Penalty[]>;
/**
* Find all penalties related to a specific protest
*/
findByProtestId(protestId: string): Promise<Penalty[]>;
/**
* Find all pending penalties (not yet applied)
*/
findPending(): Promise<Penalty[]>;
/**
* Find all penalties issued by a specific steward
*/
findIssuedBy(stewardId: string): Promise<Penalty[]>;
/**
* Save a new penalty
*/
create(penalty: Penalty): Promise<void>;
/**
* Update an existing penalty
*/
update(penalty: Penalty): Promise<void>;
/**
* Check if a penalty exists
*/
exists(id: string): Promise<boolean>;
}