mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-15 10:25:23 +00:00
feat: Add seeder module and services for all lookup tables
This commit is contained in:
12
src/main.ts
12
src/main.ts
@ -4,7 +4,7 @@ import rateLimit from 'express-rate-limit';
|
||||
import helmet from 'helmet';
|
||||
import { setupSwaggerAuthentication } from '../libs/common/src/util/user-auth.swagger.utils';
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
import { SuperAdminService } from '@app/common/helper/services/super.admin.sarvice';
|
||||
import { SeederService } from '@app/common/seed/services/seeder.service';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AuthModule);
|
||||
@ -34,10 +34,14 @@ async function bootstrap() {
|
||||
},
|
||||
}),
|
||||
);
|
||||
// Create super admin user
|
||||
const superAdminService = app.get(SuperAdminService);
|
||||
await superAdminService.createSuperAdminIfNotFound();
|
||||
|
||||
const seederService = app.get(SeederService);
|
||||
try {
|
||||
await seederService.seed();
|
||||
console.log('Seeding complete!');
|
||||
} catch (error) {
|
||||
console.error('Seeding failed!', error);
|
||||
}
|
||||
await app.listen(process.env.PORT || 4000);
|
||||
}
|
||||
console.log('Starting auth at port ...', process.env.PORT || 4000);
|
||||
|
Reference in New Issue
Block a user