54 lines
1.1 KiB
TypeScript
54 lines
1.1 KiB
TypeScript
/**
|
|
* Repository Interface: IPenaltyRepository
|
|
*
|
|
* Defines the contract for persisting and retrieving Penalty entities.
|
|
*/
|
|
|
|
import type { Penalty } from '../entities/Penalty';
|
|
|
|
export interface IPenaltyRepository {
|
|
/**
|
|
* Find a penalty by ID
|
|
*/
|
|
findById(id: string): Promise<Penalty | null>;
|
|
|
|
/**
|
|
* Find all penalties for a race
|
|
*/
|
|
findByRaceId(raceId: string): Promise<Penalty[]>;
|
|
|
|
/**
|
|
* Find all penalties for a specific driver
|
|
*/
|
|
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>;
|
|
} |