"properties": {
"approvedDate": {
"type": "date"
},
"approvedBy": {
"type": "string"
},
"time": {
"type": "string"
},
"status": {
"type": "string"
},
"reason": {
"type": "string"
},
"comments": {
"type": "string"
}
}
approvedDate and approvedBy only admin can update , others users can't update. how can i do this. please help.
thanks in advance
You can add validations in loopback models . Take a look at the below link for validations https://loopback.io/doc/en/lb2/Validating-model-data.html
In your case this can be handled in 2 different cases.
Specify the validation in before save
method of your model
If the user have no admin rights then pass an Error
in next();
https://loopback.io/doc/en/lb2/Operation-hooks.html
Use ACL and block all other access. Write a remote method to create data, in which you can check the credentials
Hope this helped.