mikro-orm / nestjs-realworld-example-app

Example real world backend API built with NestJS + MikroORM
https://realworld.io/
MIT License
280 stars 72 forks source link

Is it possible to inject Nestjs Services into a Mikro-orm Seeder class? #54

Closed nikolalukovic closed 2 years ago

nikolalukovic commented 2 years ago

In my case I have tables that reference an objectid from s3. I'd like to upload images to s3 and reference them when seeding the database. Is it possible to inject nestjs services into a Seeder class?

B4nan commented 2 years ago

If you want to use nest DI for seeders, you will need to wire it yourself somehow. Most probably you wont be able to use the CLI we have, as it instantiates the seeders and you will need to let nest handle it.