I'm making a RESTful API for a website where there are multiple type of users.
- Admin
- Vendors (Company name, address)
- Regular Users (Name, phone)
The users will always be whatever they initially registered as (permanent specialization).
I'm using Mongoose and NodeJS, and I have come up with the following Model for User so that I can easily manage login with new Social websites in future.
{
userType: { type: String, lowercase: true },
contact: {
email: { type: String, lowercase: true, index: { unique: true, sparse: true } }
},
accounts: {
local: { password: String },
facebook: { id: String, token: String }
}
}
So my question is, since I have different type of users and each type has different profile information, where should I store information regarding each of them?
Make different models for each type and add a reference key in User model? Or is there a better way?