This commit is contained in:
2025-12-11 21:06:25 +01:00
parent c49ea2598d
commit ec3ddc3a5c
227 changed files with 3496 additions and 2083 deletions

View File

@@ -121,28 +121,28 @@ class InMemoryLeagueRepository implements ILeagueRepository {
}
class InMemoryDriverRepository implements IDriverRepository {
private drivers = new Map<string, any>();
private drivers = new Map<string, { id: string; name: string; country: string }>();
constructor(drivers: Array<{ id: string; name: string; country: string }>) {
for (const driver of drivers) {
this.drivers.set(driver.id, {
...driver,
} as any);
});
}
}
async findById(id: string): Promise<any | null> {
async findById(id: string): Promise<{ id: string; name: string; country: string } | null> {
return this.drivers.get(id) ?? null;
}
async findAll(): Promise<any[]> {
async findAll(): Promise<Array<{ id: string; name: string; country: string }>> {
return [...this.drivers.values()];
}
async findByIds(ids: string[]): Promise<any[]> {
async findByIds(ids: string[]): Promise<Array<{ id: string; name: string; country: string }>> {
return ids
.map(id => this.drivers.get(id))
.filter((d): d is any => !!d);
.filter((d): d is { id: string; name: string; country: string } => !!d);
}
async create(): Promise<any> {