is it possible to inject Tree Typeorm repository into Nestjs?
I didn't find anything online or in the sources that would help me here.
Or would it be better at this point to initialize nestjs and Typeorm seperat and not use the injection of nestjs and the TypeOrm module of Nestjs?
You can also do:
constructor(@InjectRepository(Entity)
private readonly treeRepository: TreeRepository<Entity>,
) {
}
async findAllNested(): Promise<Entity[]> {
return await this.treeRepository.findTrees();
}
I found the solution myself right after I posted this. :D
You just have to inject the EntityManager with @InjectEntityManager() and then you can access .getTreeRepository().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With