Open BrunnerLivio opened 5 years ago
@zMotivat0r Any thoughts on this proposal?
I have tried before. There is a problem I need to get metadata from typeorm
and set it for nestjs
and it is initializing when server starting. So I can't get metadata through static codes.
@BrunnerLivio You can make a technical example to get Hero
metadata by extends SomeService(Hero)
Feature Request
The current implementation of extending a
TypeOrmCrudService
is cumbersome.By extending the
TypeOrmCrudService
, a user is forced to create a constructor and call the super-classes constructor. A user should not really have to care about this. This implementation also puts a@nestjsx/crud
developer in a corner. When you introduce new dependencies which are needed forTypeOrmCrudService
, you would need to force users to migrate and initialize a breaking change, because they would need to update theirsuper
-calls.What we want to do, is having the
TypeOrmCrudService
to manage its dependencies itself, and therefore use the DI directly, without having the user to pass it through asuper
-call. The answer is mixins. You better watch this video from Kamil to see what is all about.The new implementation would look like this: