before and after hooks
xpepermint opened this issue · 3 comments
xpepermint commented
We could add beforeAction
and afterAction
hooks for instanceMethods
.
kristianmandrup commented
Sounds good :)
xpepermint commented
Syntax proposal:
export const hooks = [
{
instanceMethods: ['save'],
classMethods: ['create'],
async beforeAction (next) {
// do something
return await next();
},
async afterAction (action) {
// do something
return await next();
}
}
];
export const schema = new Schema({
...
hooks
});
xpepermint commented
I think that hooks
add too much magic thus your code gets less understandable. I'll close this request for now.