refactor api modules
This commit is contained in:
21
apps/api/src/domain/bootstrap/BootstrapModule.ts
Normal file
21
apps/api/src/domain/bootstrap/BootstrapModule.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { EnsureInitialData } from '@/adapters/bootstrap/EnsureInitialData';
|
||||
import { Module, OnModuleInit } from '@nestjs/common';
|
||||
import { BootstrapProviders } from './BootstrapProviders';
|
||||
|
||||
@Module({
|
||||
providers: BootstrapProviders,
|
||||
})
|
||||
export class BootstrapModule implements OnModuleInit {
|
||||
constructor(private readonly ensureInitialData: EnsureInitialData) {}
|
||||
|
||||
async onModuleInit() {
|
||||
console.log('[Bootstrap] Initializing application data...');
|
||||
try {
|
||||
await this.ensureInitialData.execute();
|
||||
console.log('[Bootstrap] Application data initialized successfully');
|
||||
} catch (error) {
|
||||
console.error('[Bootstrap] Failed to initialize application data:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user