refactor loggable

This commit is contained in:
Bernat Exposito Domenech 2020-07-09 11:45:38 +02:00
parent bdc37e7fc1
commit c31825331d
3 changed files with 13 additions and 3 deletions

View File

@ -249,7 +249,6 @@ module.exports = function(Self) {
let newInstance = {};
if (ctx.hookState.newInstance)
Object.assign(newInstance, ctx.hookState.newInstance);
let userFk;
if (loopBackContext)
userFk = loopBackContext.active.accessToken.userId;

View File

@ -27,11 +27,11 @@ module.exports = function(Self) {
{
relation: 'salesPerson',
scope: {
fields: ['userFk'],
fields: ['userFk', 'firstName'],
include: {
relation: 'user',
scope: {
fields: ['nickname']
fields: ['name', 'nickname']
}
}
}
@ -45,6 +45,12 @@ module.exports = function(Self) {
scope: {
fields: ['id', 'name']
}
}, {
}, {
relation: 'salesPersonUser',
scope: {
fields: ['id', 'name']
}
}, {
relation: 'country',
scope: {

View File

@ -136,6 +136,11 @@
"model": "Worker",
"foreignKey": "salesPersonFk"
},
"salesPersonUser": {
"type": "belongsTo",
"model": "Account",
"foreignKey": "salesPersonFk"
},
"province": {
"type": "belongsTo",
"model": "Province",