Refactor Auth and Restaurants modules to use forward references for circular dependency resolution; import JwtModule in RestaurantsModule.

This commit is contained in:
2025-11-18 09:03:14 +03:30
parent 746769a735
commit dcce6cfdda
2 changed files with 6 additions and 4 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
import { Module } from '@nestjs/common';
import { Module, forwardRef } from '@nestjs/common';
import { AuthService } from './services/auth.service';
import { AuthController } from './controllers/auth.controller';
import { UtilsModule } from '../utils/utils.module';
@@ -28,7 +28,7 @@ import { AdminAuthGuard } from './guards/adminAuth.guard';
inject: [ConfigService],
}),
AdminModule,
RestaurantsModule,
forwardRef(() => RestaurantsModule),
MikroOrmModule.forFeature([User]),
],
controllers: [AuthController, AdminAuthController],
@@ -1,4 +1,4 @@
import { Module } from '@nestjs/common';
import { Module, forwardRef } from '@nestjs/common';
import { RestaurantsService } from './providers/restaurants.service';
import { RestaurantsController } from './controllers/restaurants.controller';
import { MikroOrmModule } from '@mikro-orm/nestjs';
@@ -8,11 +8,13 @@ import { ScheduleRepository } from './repositories/schedule.repository';
import { Schedule } from './entities/schedule.entity';
import { ScheduleService } from './providers/schedule.service';
import { ScheduleController } from './controllers/schedule.controller';
import { JwtModule } from '@nestjs/jwt';
import { AuthModule } from '../auth/auth.module';
@Module({
controllers: [RestaurantsController, ScheduleController],
providers: [RestaurantsService, RestRepository, ScheduleRepository, ScheduleService],
imports: [MikroOrmModule.forFeature([Restaurant, Schedule])],
imports: [MikroOrmModule.forFeature([Restaurant, Schedule]), JwtModule, forwardRef(() => AuthModule)],
exports: [RestRepository, ScheduleRepository, ScheduleService],
})
export class RestaurantsModule {}