alphamikle / nest_transact

Simplest transactions support for Nestjs with Typeorm
MIT License
116 stars 20 forks source link

nest-transact doensn't seem to work well with custom repository #2

Closed puroong closed 3 years ago

puroong commented 3 years ago

Hi, when I try to use it with custom repostiories, I get error saying cannot get undefined of whichever method I tried to call with custom repository

I decorated my custom repository with @EntityRepository and imported with TypeOrmModule.forFeature in my module where I declared custom repository

Is there anything more I should do to make it work?

I made repository for reproducing errors here

alphamikle commented 3 years ago

Hello! I'll figure out what's the reason of this problem in the next weekends.

moulinraphael commented 3 years ago

I very interested about this issue as well :)

moulinraphael commented 3 years ago

In getArgument

    if (typeof param === 'string') {
      ...
    } else {
      try {
        argument = manager.getCustomRepository(param);
      } catch (e) {
        argument = this.findArgumentsForProvider(param as ClassType, manager);
      }
    }

Maybe there is something smarter to test it's a CustomRepository, I tried using CustomRepositoryNotFoundError class but it's not exported by typeorm package...

alphamikle commented 3 years ago

Hello, @moulinraphael! Version 1.1.2 has the possibility to using custom repositories and some additions too. Enjoy your use! 😃