I've solved this before but a bit stuck this time so figured I'd ask for help
Potential solutions:
- If authDB_UserEntityRepository is a provider, is it part of the current AuthMigrationDepsModule?
- If authDB_UserEntityRepository is exported from a separate @Module, is that module imported within AuthMigrationDepsModule?
@Module({
imports: [ /* the Module containing authDB_UserEntityRepository */ ]
})
For additional context, this is occurring in authMigrationDeps.module.ts, which looks like this:
@Module({
imports: [AuthDatabaseModule],
providers: [
ConfigService,
UsersRepository,
AuthMigrationService,
],
})
export class AuthMigrationDepsModule {}
users.repository.ts:
@Injectable()
export class UsersRepository extends AbstractRepository<UserEntity> {
constructor(
@Optional()
@InjectDataSource('authDB')
connection: DataSource,
@InjectRepository(UserEntity, 'authDB')
private userEntity: Repository<UserEntity>,
private walletRepository: WalletsRepository,
) {
super(
userEntity ?? connection.getRepository(UserEntity),
undefined,
connection,
);
}
...
}
And authMigration.service.ts, where all of this is being used:
@Injectable()
export class AuthMigrationService {
constructor(
@InjectDataSource('authDB')
private authDataSource: DataSource,
@Optional()
@InjectRepository(WalletAddressEntity, 'authDB')
private walletEntity: Repository<WalletAddressEntity>,
@Optional() private walletsRepository: WalletsRepository,
@Optional()
@InjectRepository(UserEntity, 'authDB')
private userEntity: Repository<UserEntity>,
@Optional() private usersRepository: UsersRepository,
) {
...
}
Also if there are any resources to learn this stuff better, in particular relating to typeorm and datasources, I would love to know as I'm still very confused about the flow of importing/exporting modules and providers. Thanks in advance