129 lines
3.9 KiB
TypeScript
129 lines
3.9 KiB
TypeScript
import { Sponsor } from '@core/racing/domain/entities/sponsor/Sponsor';
|
|
import { faker } from '@faker-js/faker';
|
|
import { seedId } from './SeedIdHelper';
|
|
|
|
export class RacingSponsorFactory {
|
|
constructor(
|
|
private readonly baseDate: Date,
|
|
private readonly persistence: 'postgres' | 'inmemory' = 'inmemory',
|
|
) {}
|
|
|
|
create(): Sponsor[] {
|
|
const demoSponsor = Sponsor.create({
|
|
id: seedId('demo-sponsor-1', this.persistence),
|
|
name: 'GridPilot Sim Racing Supply',
|
|
contactEmail: 'partnerships@gridpilot.example',
|
|
logoUrl: 'http://localhost:3001/images/header.jpeg',
|
|
websiteUrl: 'https://gridpilot.example/sponsors/gridpilot-sim-racing-supply',
|
|
createdAt: faker.date.past({ years: 2, refDate: this.baseDate }),
|
|
});
|
|
|
|
const sponsorCount = 49;
|
|
|
|
const sponsorNames = [
|
|
'Red Bull Energy',
|
|
'Shell Racing',
|
|
'Michelin Tires',
|
|
'Castrol Oil',
|
|
'Pirelli Tires',
|
|
'Goodyear Tires',
|
|
'Bridgestone',
|
|
'Continental Tires',
|
|
'Dunlop Tires',
|
|
'Yokohama Tires',
|
|
'Hankook Tires',
|
|
'BFGoodrich',
|
|
'Firestone Tires',
|
|
'Kumho Tires',
|
|
'Nexen Tires',
|
|
'Falken Tires',
|
|
'Toyo Tires',
|
|
'Maxxis Tires',
|
|
'Cooper Tires',
|
|
'General Tires',
|
|
'Sparco Motorsport',
|
|
'OMP Racing',
|
|
'Simucube',
|
|
'Fanatec',
|
|
'Moza Racing',
|
|
'Heusinkveld Engineering',
|
|
'Next Level Racing',
|
|
'Thrustmaster Racing',
|
|
'Logitech G Racing',
|
|
'GoPro Motorsports',
|
|
'VRS DirectForce',
|
|
'Ascher Racing',
|
|
'RaceRoom Store',
|
|
'iRacing Credits',
|
|
'Assetto Corsa Competizione',
|
|
'RaceDepartment',
|
|
'SimRacing.GP',
|
|
'Grid Finder',
|
|
'Racing Gloves Co.',
|
|
'Hydration Labs',
|
|
'Energy Bar Co.',
|
|
'Broadcast Overlay Studio',
|
|
'Carbon Fiber Works',
|
|
'Brake Pad Supply',
|
|
'Pit Strategy Analytics',
|
|
'Telemetry Tools',
|
|
'Setup Shop',
|
|
'Streaming Partner',
|
|
'Hardware Tuning Lab',
|
|
'Trackside Media',
|
|
];
|
|
|
|
const logoPaths = [
|
|
'http://localhost:3001/images/header.jpeg',
|
|
'http://localhost:3001/images/ff1600.jpeg',
|
|
'http://localhost:3001/images/avatars/male-default-avatar.jpg',
|
|
'http://localhost:3001/images/avatars/female-default-avatar.jpeg',
|
|
'http://localhost:3001/images/avatars/neutral-default-avatar.jpeg',
|
|
'http://localhost:3001/images/leagues/placeholder-cover.svg',
|
|
'http://localhost:3001/favicon.svg',
|
|
];
|
|
|
|
const websiteUrls = [
|
|
'https://www.redbull.com',
|
|
'https://www.shell.com',
|
|
'https://www.michelin.com',
|
|
'https://www.castrol.com',
|
|
'https://www.pirelli.com',
|
|
'https://www.goodyear.com',
|
|
'https://www.bridgestone.com',
|
|
'https://www.continental-tires.com',
|
|
'https://www.dunlop.eu',
|
|
'https://www.yokohamatire.com',
|
|
'https://www.hankooktire.com',
|
|
'https://www.sparco-official.com',
|
|
'https://www.omp.com',
|
|
'https://fanatec.com',
|
|
'https://mozaracing.com',
|
|
'https://heusinkveld.com',
|
|
'https://nextlevelracing.com',
|
|
'https://www.thrustmaster.com',
|
|
'https://www.logitechg.com',
|
|
'https://gopro.com',
|
|
];
|
|
|
|
const sponsors = Array.from({ length: sponsorCount }, (_, idx) => {
|
|
const i = idx + 1;
|
|
const name = sponsorNames[idx % sponsorNames.length]!;
|
|
const safeName = name.replace(/\s+/g, '').toLowerCase();
|
|
|
|
const logoUrl = logoPaths[idx % logoPaths.length]!;
|
|
const websiteUrl = websiteUrls[idx % websiteUrls.length]!;
|
|
|
|
return Sponsor.create({
|
|
id: seedId(`sponsor-${i}`, this.persistence),
|
|
name,
|
|
contactEmail: `partnerships+${safeName}@example.com`,
|
|
...(logoUrl ? { logoUrl } : {}),
|
|
...(websiteUrl ? { websiteUrl } : {}),
|
|
createdAt: faker.date.past({ years: 5, refDate: this.baseDate }),
|
|
});
|
|
});
|
|
|
|
return [demoSponsor, ...sponsors];
|
|
}
|
|
} |