seed data
This commit is contained in:
@@ -61,5 +61,61 @@ export class EnsureInitialData {
|
||||
}
|
||||
|
||||
this.logger.info(`[Bootstrap] Achievements: ${createdCount} created, ${existingCount} already exist`);
|
||||
|
||||
// Create additional users for comprehensive seeding
|
||||
await this.createAdditionalUsers();
|
||||
|
||||
// Create user achievements linking users to achievements
|
||||
await this.createUserAchievements();
|
||||
}
|
||||
|
||||
private async createAdditionalUsers(): Promise<void> {
|
||||
const userConfigs = [
|
||||
// Driver with iRacing linked
|
||||
{ displayName: 'Max Verstappen', email: 'max@racing.com', password: 'Test123!', iracingCustomerId: '12345' },
|
||||
// Driver without email
|
||||
{ displayName: 'Lewis Hamilton', email: undefined, password: undefined, iracingCustomerId: '67890' },
|
||||
// Sponsor user
|
||||
{ displayName: 'Sponsor Inc', email: 'sponsor@example.com', password: 'Test123!', iracingCustomerId: undefined },
|
||||
// Various driver profiles
|
||||
{ displayName: 'Charles Leclerc', email: 'charles@ferrari.com', password: 'Test123!', iracingCustomerId: '11111' },
|
||||
{ displayName: 'Lando Norris', email: 'lando@mclaren.com', password: 'Test123!', iracingCustomerId: '22222' },
|
||||
{ displayName: 'George Russell', email: 'george@mercedes.com', password: 'Test123!', iracingCustomerId: '33333' },
|
||||
{ displayName: 'Carlos Sainz', email: 'carlos@ferrari.com', password: 'Test123!', iracingCustomerId: '44444' },
|
||||
{ displayName: 'Fernando Alonso', email: 'fernando@aston.com', password: 'Test123!', iracingCustomerId: '55555' },
|
||||
{ displayName: 'Sergio Perez', email: 'sergio@redbull.com', password: 'Test123!', iracingCustomerId: '66666' },
|
||||
{ displayName: 'Valtteri Bottas', email: 'valtteri@sauber.com', password: 'Test123!', iracingCustomerId: '77777' },
|
||||
];
|
||||
|
||||
let createdCount = 0;
|
||||
|
||||
for (const config of userConfigs) {
|
||||
if (!config.email) {
|
||||
// Skip users without email for now (would need different creation method)
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
const result = await this.signupUseCase.execute({
|
||||
email: config.email,
|
||||
password: config.password!,
|
||||
displayName: config.displayName,
|
||||
});
|
||||
|
||||
if (result.isOk()) {
|
||||
createdCount++;
|
||||
}
|
||||
} catch (error) {
|
||||
// User might already exist, skip
|
||||
}
|
||||
}
|
||||
|
||||
this.logger.info(`[Bootstrap] Created ${createdCount} additional users`);
|
||||
}
|
||||
|
||||
private async createUserAchievements(): Promise<void> {
|
||||
// This would require access to user and achievement repositories
|
||||
// For now, we'll log that this would be done
|
||||
this.logger.info('[Bootstrap] User achievements would be created here (requires repository access)');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user