refs #5666 perf: loggable to mixin
This commit is contained in:
parent
3c5af184bb
commit
a102c3f3a9
|
@ -0,0 +1,12 @@
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
async function handleObserve(ctx) {
|
||||||
|
ctx.options.httpCtx = LoopBackContext.getCurrentContext();
|
||||||
|
}
|
||||||
|
module.exports = function(Self) {
|
||||||
|
let Mixin = {
|
||||||
|
'before save': handleObserve,
|
||||||
|
'before delete': handleObserve,
|
||||||
|
};
|
||||||
|
for (const [listener, handler] of Object.entries(Mixin))
|
||||||
|
Self.observe(listener, handler);
|
||||||
|
};
|
Loading…
Reference in New Issue