fix seeds
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Driver } from '@core/racing/domain/entities/Driver';
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
export class RacingDriverFactory {
|
||||
constructor(
|
||||
@@ -7,7 +8,7 @@ export class RacingDriverFactory {
|
||||
) {}
|
||||
|
||||
create(): Driver[] {
|
||||
const countries = ['DE', 'NL', 'FR', 'GB', 'US', 'CA', 'SE', 'NO', 'IT', 'ES'] as const;
|
||||
const countries = ['DE', 'NL', 'FR', 'GB', 'US', 'CA', 'SE', 'NO', 'IT', 'ES', 'AU', 'BR', 'JP', 'KR', 'RU', 'PL', 'CZ', 'HU', 'AT', 'CH'] as const;
|
||||
|
||||
return Array.from({ length: this.driverCount }, (_, idx) => {
|
||||
const i = idx + 1;
|
||||
@@ -15,15 +16,11 @@ export class RacingDriverFactory {
|
||||
return Driver.create({
|
||||
id: `driver-${i}`,
|
||||
iracingId: String(100000 + i),
|
||||
name: `Driver ${i}`,
|
||||
country: countries[idx % countries.length]!,
|
||||
bio: `Demo driver #${i} seeded for in-memory mode.`,
|
||||
joinedAt: this.addDays(this.baseDate, -90 + i),
|
||||
name: faker.person.fullName(),
|
||||
country: faker.helpers.arrayElement(countries),
|
||||
bio: faker.lorem.sentences(2),
|
||||
joinedAt: faker.date.past({ years: 2, refDate: this.baseDate }),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private addDays(date: Date, days: number): Date {
|
||||
return new Date(date.getTime() + days * 24 * 60 * 60 * 1000);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user