You need to provide some classes and decorators yourself to maintain the same style as typeorm@2.x
.
@EntityRepository(UserEntity)
export class UserRepository extends Repository<UserEntity> {}
↓
@CustomRepository(UserEntity)
export class UserRepository extends Repository<UserEntity> {}
@Module({
exports: [UserService],
imports: [TypeOrmModule.forFeature([UserRepository])],
providers: [UserService],
})
export class UserModule {}
↓
@Module({
exports: [UserService],
imports: [TypeOrmExModule.forCustomRepository([UserRepository])],
providers: [UserService],
})
export class UserModule {}
Firstly, thanks for the gist @anchan828
I don't know nothing about nest js yet and I need to make this update. I did everything but in my service I was injecting the repository with this decorator @InjectRepository as below:
And after the modifications I'm getting this error:
Nest can't resolve dependencies of the ABCService (?). Please make sure that the argument ABC_ABCRepository at index [0] is available in the ABCModule context.
How can i fix this?
I've tried to manually construct the repository inside the service constructor, but, I don't have any of the necessary arguments there, as EntityManager and QueryRunner.