refactor loggable
This commit is contained in:
parent
bdc37e7fc1
commit
c31825331d
|
@ -249,7 +249,6 @@ module.exports = function(Self) {
|
||||||
let newInstance = {};
|
let newInstance = {};
|
||||||
if (ctx.hookState.newInstance)
|
if (ctx.hookState.newInstance)
|
||||||
Object.assign(newInstance, ctx.hookState.newInstance);
|
Object.assign(newInstance, ctx.hookState.newInstance);
|
||||||
|
|
||||||
let userFk;
|
let userFk;
|
||||||
if (loopBackContext)
|
if (loopBackContext)
|
||||||
userFk = loopBackContext.active.accessToken.userId;
|
userFk = loopBackContext.active.accessToken.userId;
|
||||||
|
|
|
@ -27,11 +27,11 @@ module.exports = function(Self) {
|
||||||
{
|
{
|
||||||
relation: 'salesPerson',
|
relation: 'salesPerson',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['userFk', 'firstName'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['nickname']
|
fields: ['name', 'nickname']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,12 @@ module.exports = function(Self) {
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id', 'name']
|
fields: ['id', 'name']
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
}, {
|
||||||
|
relation: 'salesPersonUser',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'name']
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
relation: 'country',
|
relation: 'country',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -136,6 +136,11 @@
|
||||||
"model": "Worker",
|
"model": "Worker",
|
||||||
"foreignKey": "salesPersonFk"
|
"foreignKey": "salesPersonFk"
|
||||||
},
|
},
|
||||||
|
"salesPersonUser": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Account",
|
||||||
|
"foreignKey": "salesPersonFk"
|
||||||
|
},
|
||||||
"province": {
|
"province": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Province",
|
"model": "Province",
|
||||||
|
|
Loading…
Reference in New Issue