70 lines
1.4 KiB
TypeScript
70 lines
1.4 KiB
TypeScript
/**
|
|
* Application Port: IResultRepository
|
|
*
|
|
* Repository interface for Result entity CRUD operations.
|
|
* Defines async methods using domain entities as types.
|
|
*/
|
|
|
|
import { Result } from '../../domain/entities/Result';
|
|
|
|
export interface IResultRepository {
|
|
/**
|
|
* Find a result by ID
|
|
*/
|
|
findById(id: string): Promise<Result | null>;
|
|
|
|
/**
|
|
* Find all results
|
|
*/
|
|
findAll(): Promise<Result[]>;
|
|
|
|
/**
|
|
* Find results by race ID
|
|
*/
|
|
findByRaceId(raceId: string): Promise<Result[]>;
|
|
|
|
/**
|
|
* Find results by driver ID
|
|
*/
|
|
findByDriverId(driverId: string): Promise<Result[]>;
|
|
|
|
/**
|
|
* Find results by driver ID for a specific league
|
|
*/
|
|
findByDriverIdAndLeagueId(driverId: string, leagueId: string): Promise<Result[]>;
|
|
|
|
/**
|
|
* Create a new result
|
|
*/
|
|
create(result: Result): Promise<Result>;
|
|
|
|
/**
|
|
* Create multiple results
|
|
*/
|
|
createMany(results: Result[]): Promise<Result[]>;
|
|
|
|
/**
|
|
* Update an existing result
|
|
*/
|
|
update(result: Result): Promise<Result>;
|
|
|
|
/**
|
|
* Delete a result by ID
|
|
*/
|
|
delete(id: string): Promise<void>;
|
|
|
|
/**
|
|
* Delete all results for a race
|
|
*/
|
|
deleteByRaceId(raceId: string): Promise<void>;
|
|
|
|
/**
|
|
* Check if a result exists by ID
|
|
*/
|
|
exists(id: string): Promise<boolean>;
|
|
|
|
/**
|
|
* Check if results exist for a race
|
|
*/
|
|
existsByRaceId(raceId: string): Promise<boolean>;
|
|
} |