I have the following provider defined in my forRootAsync method of my custom module:
{
provide: RegistrationService,
useFactory: async (amqpConnection: AmqpConnection, ds: DataSource) => {
const mappingRepo = ds.getRepository(Mapping)
const regService = new RegistrationService(mappingRepo, amqpConnection);
await regService.initializeRoutingKeys();
console.log(regService.insightsRoutingKeys)
console.log('Got here')
return regService;
},
inject: [AmqpConnection, DataSource]
}
This works perfectly, but I was wondering if I can somehow use something like the @simple glenRepository decorator that you can use in a class constructor to inject the mappingRepo directly to the factory method instead of needing to do what I did