Shared entities & services #152
-
Hello, first of all, I want to thank @Sairyss for this beautiful repository that is helping me a lot to learn more about NestJS. For example, in auth, I need to be able to create users, validate their credentials, update aspects like email or phone verification, etc. All these changes need to impact the database. In doctors, for example, I should be able to fetch all patients from a shift, which would indirectly or directly require the User entity, possibly through a Patient class that extends User. In patients, to get the patient's data, I should be able to access the users. What could be a solution, and where would it be reflected in the folder architecture? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Just treat User/Authentication module as a shared module, which is typical for most kinds of apps. |
Beta Was this translation helpful? Give feedback.
Just treat User/Authentication module as a shared module, which is typical for most kinds of apps.
You can put it either in
modules/User
, or if you want explicitly state that it's shared, you can put it under shared/common directory, for examplemodules/shared/User
.Whatever you like more.