inmemory to postgres
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
import { League } from '@core/racing/domain/entities/League';
|
||||
import { Race } from '@core/racing/domain/entities/Race';
|
||||
import { Track } from '@core/racing/domain/entities/Track';
|
||||
import { seedId } from './SeedIdHelper';
|
||||
|
||||
export class RacingRaceFactory {
|
||||
constructor(private readonly baseDate: Date) {}
|
||||
constructor(
|
||||
private readonly baseDate: Date,
|
||||
private readonly persistence: 'postgres' | 'inmemory' = 'inmemory',
|
||||
) {}
|
||||
|
||||
create(leagues: League[], tracks: Track[]): Race[] {
|
||||
const cars = ['GT3 – Porsche 911', 'GT3 – BMW M4', 'LMP3 Prototype', 'GT4 – Alpine', 'Touring – Civic'];
|
||||
@@ -51,7 +55,7 @@ export class RacingRaceFactory {
|
||||
}
|
||||
|
||||
const base = {
|
||||
id: `race-${i}`,
|
||||
id: seedId(`race-${i}`, this.persistence),
|
||||
leagueId,
|
||||
scheduledAt,
|
||||
track: track.name.toString(),
|
||||
|
||||
Reference in New Issue
Block a user