Closed armansujoyan closed 2 years ago
Hello @armansujoyan, you can use excluded
option of method withTransaction
with passing your ConfigService
to it. Of course - if your ConfigService
doesn't contain any methods, which must be run in the transaction and if dependencies of ConfigService
don't have any same methods.
Here is an example:
// ...
await this.someService.withTransaction(transactionEntityManager, { excluded: [ConfigService] }).someFunctionWhichWillUseTransactions(payload);
// ...
@armansujoyan is that solve your problem?
@alphamikle I tried using exclude
option but it didn't work, as the reflector wasn't able to find the service within a context.
Well, it is strange, but maybe the ConfigService
uses some kind of magic while creating and needs to investigate. Please, if you can - provide some example which describes your problem.
@armansujoyan, hello!
Feel free to send PR with the fix of this issue, if it is annoying for you. Unfortunately for now I don't have much time to fix specific errors.
There is a config service that I have configured to use @nestjs/config module underneath. Whenever this config service is injected, I no longer can get the config variables from the service when one of the services is inheriting from the TransactionFor class.