2023-02-09 16:10:08 -06:00
|
|
|
import { Module } from '@nestjs/common';
|
2023-02-16 16:49:52 -06:00
|
|
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
|
|
|
import { ConfigModule, ConfigService } from '@nestjs/config'
|
2023-02-09 16:10:08 -06:00
|
|
|
import { AppController } from './app.controller';
|
|
|
|
|
import { AppService } from './app.service';
|
2023-02-16 16:49:52 -06:00
|
|
|
import { EventosModule } from './eventos/eventos.module';
|
|
|
|
|
import { ParticipanteController } from './participante/participante.controller';
|
|
|
|
|
import { ParticipanteModule } from './participante/participante.module';
|
|
|
|
|
import { EventoParticipanteModule } from './evento-participante/evento-participante/evento-participante.module';
|
2023-02-22 16:28:12 -06:00
|
|
|
import { UsuarioModule } from './usuario/usuario.module';
|
|
|
|
|
import { AuthModule } from './auth/auth.module';
|
|
|
|
|
import { PassportModule } from '@nestjs/passport';
|
|
|
|
|
import { JwtModule } from '@nestjs/jwt';
|
2023-02-27 14:01:13 -06:00
|
|
|
import { Evento } from './eventos/evento.entity';
|
|
|
|
|
import { Participante } from './participante/participante.entity';
|
|
|
|
|
import { EventoParticipante } from './evento-participante/evento-participante/eventoParticipante.entity';
|
|
|
|
|
import { Usuario } from './usuario/usuario.entity';
|
2023-02-09 16:10:08 -06:00
|
|
|
|
|
|
|
|
@Module({
|
2023-02-16 16:49:52 -06:00
|
|
|
imports: [
|
2023-02-27 14:01:13 -06:00
|
|
|
ConfigModule.forRoot({
|
|
|
|
|
envFilePath: '.env',
|
|
|
|
|
isGlobal: true}),
|
|
|
|
|
TypeOrmModule.forRootAsync({
|
|
|
|
|
imports:[ConfigModule],
|
|
|
|
|
inject:[ConfigService],
|
|
|
|
|
useFactory: async (configService: ConfigService) => ({
|
|
|
|
|
type: 'mariadb',
|
|
|
|
|
host: configService.get('DB_HOST'),
|
|
|
|
|
port: configService.get('DB_PORT'),
|
|
|
|
|
username: configService.get('DB_USER'),
|
|
|
|
|
password: configService.get('DB_PASSWORD'),
|
|
|
|
|
database: configService.get('DB_NAME'),
|
|
|
|
|
entities: [Evento, Participante, EventoParticipante, Usuario],
|
|
|
|
|
synchronize: true
|
|
|
|
|
})
|
2023-02-16 16:49:52 -06:00
|
|
|
}),
|
|
|
|
|
EventosModule,
|
|
|
|
|
ParticipanteModule,
|
2023-02-22 16:28:12 -06:00
|
|
|
EventoParticipanteModule,
|
|
|
|
|
UsuarioModule,
|
|
|
|
|
AuthModule, PassportModule, JwtModule.register({})],
|
2023-02-16 16:49:52 -06:00
|
|
|
controllers: [AppController, ParticipanteController],
|
2023-02-13 13:24:30 -06:00
|
|
|
providers: [AppService],
|
2023-02-09 16:10:08 -06:00
|
|
|
})
|
2023-02-16 16:49:52 -06:00
|
|
|
export class AppModule {
|
|
|
|
|
static port: number
|
|
|
|
|
constructor(private readonly configService: ConfigService){
|
|
|
|
|
AppModule.port = this.configService.get('PORT')
|
|
|
|
|
}
|
|
|
|
|
}
|