Hey i have trouble to solve the dependency of my controller. I got this problem very often, and i have no idea how to sole them quickly and clean.
If anybody have a process, or anything that can help me to solve those quickly, i would appreciate it alot, because when i have this kind of problems, im just jugling randomly with the import / export /provider in the module awaiting magic to happen.
In my current case i can't find wich changes i need to make...
// groupe.module.ts
@Module({
imports: [TypeOrmModule.forFeature([Group, Draw, Calls])],
providers: [GroupService],
controllers: [GroupController],
exports:[GroupService]
})
export class GroupeModule {}
My entity
// groupe.entity.ts
@Entity()
export class Group {
@PrimaryGeneratedColumn()
id: number;
@ManyToMany(() => Calls)
@JoinTable()
calls: Calls[];
@ManyToMany(() => Draw)
@JoinTable()
draws: Draw[];
}
app module
@Module({
imports: [
TypeOrmModule.forRoot({
type: 'mysql',
host: 'localhost',
port: 3306,
username: 'root',
password: 'root',
database: 'happidb',
autoLoadEntities: true,
entities: [],
synchronize: true,
}),
CallsModule,
ResponseModule,
DrawModule,
GroupeModule
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
ERROR [ExceptionHandler] Nest can't resolve dependencies of the GroupController (?). Please make sure that the argument GroupService at index [0] is available in the GroupeModule context.