inmemory to postgres

This commit is contained in:
2025-12-29 19:44:11 +01:00
parent f5639a367f
commit 12ae6e1dad
17 changed files with 361 additions and 94 deletions

View File

@@ -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(),