Hello, everyone.
To keep it short,
-
I have three modules: AppModule (bootstrapped) , SharedModule, CustomModule
-
SharedModule contains an injectable service called StoreService and a model called modelSchemas in which mongoose schemas are assigned via a BehaviorSubject.
-
In AppModule>onModuleInit, storeService.modelSchemas is assigned (via next function) an object of schemas (key modelName, value schema).
-
In CustomController>onModuleInit, storeService.modelSchemas is retrieved.
At this point, I want to generate controllers based on the modelSchemas (path will include embedded array names).
How can this be done, please?
Note that mongoose connections are done via a middleware as uri is indirectly defined in the Authorization token. So the method defined in the docs to make the mongoose connection has not been followed.