Hello im trying to use Global Modules but i get this error ```js
[Nest] 69499 - 07/18/2023, 10:57:37 PM ERROR [ExceptionHandler] Nest can't resolve dependencies of the AuthService (?). Please make sure that the argument Model at index [0] is available in the AuthModule context.
Potential solutions:
- If Model is a provider, is it part of the current AuthModule?
- If Model is exported from a separate @Module, is that module imported within AuthModule?
@Module({
imports: [ /* the Module containing Model */ ]
})
Error: Nest can't resolve dependencies of the AuthService (?). Please make sure that the argument Model at index [0] is available in the AuthModule context. this is my app.modulejs
import { Global, Module } from '@nestjs/common';
import { MongooseModule } from '@nestjs/mongoose';
import { AuthService } from './auth/auth.service';
import { AuthModule } from './auth/auth.module';
import { User } from './app_modules/schemas/user.schema';
import { Menu } from './app_modules/schemas/menu.schama';
@Global()
@Module({
imports: [
MongooseModule.forRoot('mongodb://localhost:27017/nest'),
AuthModule,
User,
Menu,
],
providers: [AuthService, User, Menu],
exports: [AuthService],
})
export class AppModule {}
and this my auth.module.tsjs
import { Global, Module } from '@nestjs/common';
import { AuthService } from './auth.service';
import { AuthController } from './auth.controller';
@Global()
@Module({
exports: [AuthService],
providers: [AuthService],
controllers: [AuthController],
})
export class AuthModule {}