10 lines
335 B
JavaScript
10 lines
335 B
JavaScript
|
const LoopBackContext = require('loopback-context');
|
||
|
|
||
|
module.exports = Self => {
|
||
|
Self.observe('before save', async function(ctx) {
|
||
|
const changes = ctx.data || ctx.instance;
|
||
|
const loopBackContext = LoopBackContext.getCurrentContext();
|
||
|
changes.workerFk = loopBackContext.active.accessToken.userId;
|
||
|
});
|
||
|
};
|