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(); }); Self.observe('before delete', async function(ctx) { ctx.options.httpCtx = LoopBackContext.getCurrentContext(); }); };