Refactor Auth and Restaurants modules to use forward references for circular dependency resolution; import JwtModule in RestaurantsModule.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module, forwardRef } from '@nestjs/common';
|
||||||
import { AuthService } from './services/auth.service';
|
import { AuthService } from './services/auth.service';
|
||||||
import { AuthController } from './controllers/auth.controller';
|
import { AuthController } from './controllers/auth.controller';
|
||||||
import { UtilsModule } from '../utils/utils.module';
|
import { UtilsModule } from '../utils/utils.module';
|
||||||
@@ -28,7 +28,7 @@ import { AdminAuthGuard } from './guards/adminAuth.guard';
|
|||||||
inject: [ConfigService],
|
inject: [ConfigService],
|
||||||
}),
|
}),
|
||||||
AdminModule,
|
AdminModule,
|
||||||
RestaurantsModule,
|
forwardRef(() => RestaurantsModule),
|
||||||
MikroOrmModule.forFeature([User]),
|
MikroOrmModule.forFeature([User]),
|
||||||
],
|
],
|
||||||
controllers: [AuthController, AdminAuthController],
|
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 { RestaurantsService } from './providers/restaurants.service';
|
||||||
import { RestaurantsController } from './controllers/restaurants.controller';
|
import { RestaurantsController } from './controllers/restaurants.controller';
|
||||||
import { MikroOrmModule } from '@mikro-orm/nestjs';
|
import { MikroOrmModule } from '@mikro-orm/nestjs';
|
||||||
@@ -8,11 +8,13 @@ import { ScheduleRepository } from './repositories/schedule.repository';
|
|||||||
import { Schedule } from './entities/schedule.entity';
|
import { Schedule } from './entities/schedule.entity';
|
||||||
import { ScheduleService } from './providers/schedule.service';
|
import { ScheduleService } from './providers/schedule.service';
|
||||||
import { ScheduleController } from './controllers/schedule.controller';
|
import { ScheduleController } from './controllers/schedule.controller';
|
||||||
|
import { JwtModule } from '@nestjs/jwt';
|
||||||
|
import { AuthModule } from '../auth/auth.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [RestaurantsController, ScheduleController],
|
controllers: [RestaurantsController, ScheduleController],
|
||||||
providers: [RestaurantsService, RestRepository, ScheduleRepository, ScheduleService],
|
providers: [RestaurantsService, RestRepository, ScheduleRepository, ScheduleService],
|
||||||
imports: [MikroOrmModule.forFeature([Restaurant, Schedule])],
|
imports: [MikroOrmModule.forFeature([Restaurant, Schedule]), JwtModule, forwardRef(() => AuthModule)],
|
||||||
exports: [RestRepository, ScheduleRepository, ScheduleService],
|
exports: [RestRepository, ScheduleRepository, ScheduleService],
|
||||||
})
|
})
|
||||||
export class RestaurantsModule {}
|
export class RestaurantsModule {}
|
||||||
|
|||||||
Reference in New Issue
Block a user