edited app module + main

This commit is contained in:
sdraris 2025-08-28 12:05:48 +02:00
parent be3cd41521
commit df4e42ae66
2 changed files with 58 additions and 53 deletions

View File

@ -13,6 +13,8 @@ import { APP_FILTER, APP_GUARD, APP_INTERCEPTOR } from '@nestjs/core';
import { TransformInterceptor } from './common/interceptors/transform.interceptor';
import { RolesGuard } from './common/guards/roles.guard';
import { ParentsModule } from './routes/parents/parents.module';
import { JwtModule } from '@nestjs/jwt';
import { AuthModule } from './routes/auth/auth.module';
@Module({
imports: [
@ -27,7 +29,8 @@ import { ParentsModule } from './routes/parents/parents.module';
validationSchema: configValidationSchema,
}),
TypeOrmModule.forRootAsync({
imports: [ConfigModule],
imports: [ConfigModule,
],
inject: [ConfigService],
useFactory: (config: ConfigService) => ({
type: 'postgres',
@ -44,6 +47,7 @@ import { ParentsModule } from './routes/parents/parents.module';
}),
UserModule,
ParentsModule,
AuthModule,
],
controllers: [AppController],
providers: [AppService,

View File

@ -25,12 +25,13 @@ async function bootstrap() {
const reflector = app.get(Reflector);
app.useGlobalGuards(
new AuthGuard(app.get(JwtService)),
new RolesGuard(reflector)
new AuthGuard(app.get(JwtService), app.get(Reflector)),
new RolesGuard(app.get(Reflector))
);
await app.listen(port);
console.log(`✅ P'titsPas API is running on: ${await app.getUrl()}`);
console.log(process.env.POSTGRES_DB);
}
bootstrap().catch((err) => {