2025-09-04 20:17:04 -04:00
|
|
|
import { Module } from '@nestjs/common';
|
2025-09-09 21:19:17 -04:00
|
|
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
2025-09-04 20:17:04 -04:00
|
|
|
import { AppController } from './app.controller';
|
|
|
|
|
import { AppService } from './app.service';
|
2025-09-04 21:04:15 -04:00
|
|
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
2025-09-09 21:19:17 -04:00
|
|
|
import { StudentModule } from './student/student.module';
|
|
|
|
|
import { UserModule } from './user/user.module';
|
2025-09-04 21:04:15 -04:00
|
|
|
import { User } from './user/entities/user.entity';
|
2025-09-10 16:15:36 -06:00
|
|
|
import { Student } from './student/entities/student.entity';
|
|
|
|
|
import { TicketModule } from './ticket/ticket.module';
|
2025-09-04 20:17:04 -04:00
|
|
|
|
|
|
|
|
@Module({
|
2025-09-04 21:04:15 -04:00
|
|
|
imports: [
|
2025-09-09 21:19:17 -04:00
|
|
|
ConfigModule.forRoot({
|
2025-09-10 16:15:36 -06:00
|
|
|
isGlobal: true,
|
2025-09-09 21:19:17 -04:00
|
|
|
envFilePath: '.env',
|
|
|
|
|
}),
|
|
|
|
|
TypeOrmModule.forRootAsync({
|
|
|
|
|
inject: [ConfigService],
|
|
|
|
|
useFactory: async (configService: ConfigService) => ({
|
|
|
|
|
type: 'mariadb',
|
|
|
|
|
host: configService.get<string>('DB_HOST'),
|
|
|
|
|
port: configService.get<number>('DB_PORT'),
|
|
|
|
|
username: configService.get<string>('DB_USER'),
|
|
|
|
|
password: configService.get<string>('DB_PASSWORD'),
|
|
|
|
|
database: configService.get<string>('DB_NAME'),
|
2025-09-10 16:15:36 -06:00
|
|
|
entities: [User, Student],
|
2025-09-09 21:19:17 -04:00
|
|
|
synchronize: false,
|
|
|
|
|
}),
|
2025-09-04 21:04:15 -04:00
|
|
|
}),
|
2025-09-09 21:19:17 -04:00
|
|
|
UserModule,
|
2025-09-10 16:15:36 -06:00
|
|
|
StudentModule,
|
|
|
|
|
TicketModule,
|
2025-09-09 21:19:17 -04:00
|
|
|
],
|
2025-09-04 20:17:04 -04:00
|
|
|
controllers: [AppController],
|
|
|
|
|
providers: [AppService],
|
|
|
|
|
})
|
2025-09-09 21:19:17 -04:00
|
|
|
export class AppModule {}
|