Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个带有属性的模型:status状态statusId可以是:
status
statusId
StatusId & Status 描述如下:
打开
加工
关
拒绝
失败
我想要的是,如果我插入或更新模型的状态,那么statusId应该会自动更新。
你可以使用两件事来实现这个场景
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(); });