Creating a user schema in mongoose.
Parameters to be defined in user -
- Name
- Email
- Password
- Role
- news tags - this will include tags of the news that user wants to see, editable by user.
- subscribed - if true than we will send news mail letter to the user, else we will not.
- Anything necessary to manage authentication and authorization.
Roles will be of three types -
- User
- Publisher
- Admin
Therefore create an enum check and set the default role to user.
Creating a user schema in mongoose.
Parameters to be defined in user -
Roles will be of three types -
Therefore create an enum check and set the default role to user.