salix/loopback/common/models/loggable.js

16 lines
428 B
JavaScript
Raw Permalink Normal View History

2018-10-03 07:37:34 +00:00
const LoopBackContext = require('loopback-context');
module.exports = function(Self) {
Self.setup = function() {
Self.super_.setup.call(this);
};
Self.observe('before save', async function(ctx) {
ctx.options.httpCtx = LoopBackContext.getCurrentContext();
});
2023-01-10 14:24:22 +00:00
Self.observe('before delete', async function(ctx) {
ctx.options.httpCtx = LoopBackContext.getCurrentContext();
2018-10-03 07:37:34 +00:00
});
};