I have a model with properties: status
and statusId
where statuses can be:
StatusId & Status are described below:
open
processing
close
reject
failure
What I want is if I insert or update the status of my model then statusId should automatically update accordingly.
You can use two things to implement this scenario
Observe
<model>.observe('before save', function (ctx, next) {
// check the ctx and add the necessary validations
}
app.remotes().before('**', (ctx, next) => {
// do stuff with ctx.args.options
next();
});