Reputation: 5291
I am trying to create a loopback model which stores the details of a user, the model is supposed to store the details of the user like his address, email and phone number and so on.
My doubt is whether I create a separate model which stores these details separately or do i store the fields along with the user credentials into a single model ?
UPDATE: After going through and experimenting on my project I have to conclude that storing userdetails on the same model is not a good idea as Loopback would validate the users credentials and takes in the user details as part of the post request and if the properties there are set to required, then it automatically fails.
Upvotes: 0
Views: 171
Reputation: 2781
You can extend the built-in User
model and add the details to your new model. See https://github.com/strongloop/loopback-example-access-control/blob/master/common/models/user.json#L3.
Upvotes: 2