You need to provide some classes and decorators yourself to maintain the same style as [email protected]
.
@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 {}
any idea on how to make use of custom repositories when working with transactions using
and then pass queryRunner to the service where we normally would do:
const userRepository: UserRepository = queryRunner.manager.getCustomRepository(UserRepository)
however by now using customRepositories from this github thread the queryRunner no longer holds any instances of the repositories and thus throwing the error:
Custom repository UserRepository was not found. Did you forgot to put @EntityRepository decorator on it?