wip
This commit is contained in:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user