Total v4 is not sending operation object when using EXEC
I tried to validate a model using schema.required function, but its always empty.
this is the function my route calls
async function addPracticeOrder() {
const self = this,
{body} = self;
EXEC('+orderPractice --> update', body, function(err, response){
if(err){
self.status = 500;
self.json(err);
return;
}
self.status = 200;
self.json(response);
}, self);
}
my schema definition
schema.define('practice', 'PracticeBase');
schema.required('practice', (model, op) => {
console.log(model);
console.log(op);
});
in those logs, model has a SchemaValue and operation an Empty Object
Operation
{}
Model
SchemaValue {
practice: SchemaValue {
name: 'Coral',
legalAddress: '1535 Sunset Drive Coral Gables, FL 33146',
status: 'Active',
products: []
}
}
Am I doing something wrong?
Hi @LandyCuadra, here is the repo for Total.js v4: https://github.com/totaljs/framework4
I don't see your entire schema, please send me it - I need to test it.
Yes, there is a bug. I'm going to fix it. BTW: EXEC() supports promise, just call it without callback.
I have fixed it, please try it: $ npm install total4@beta and let me know.
Great it's working fine know, thanks. sorry will submit the next issue to the correct repo
@LandyCuadra great, and no problem. Thank you for the report.