Merge branch 'dev' of http://git.verdnatura.es/salix into dev
This commit is contained in:
commit
c1893be92a
|
@ -1,14 +1,16 @@
|
|||
const app = require(`${servicesDir}/client/server/server`);
|
||||
|
||||
describe('Client addressesPropagateRe', () => {
|
||||
let client;
|
||||
beforeEach(async() => {
|
||||
client = await app.models.Client.findById(101);
|
||||
await app.models.Address.update({clientFk: 101}, {isEqualizated: false});
|
||||
await app.models.Client.update({id: 101}, {hasToInvoiceByAddress: true});
|
||||
await client.updateAttributes({hasToInvoiceByAddress: true});
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await app.models.Address.update({clientFk: 101}, {isEqualizated: false});
|
||||
await app.models.Client.update({id: 101}, {hasToInvoiceByAddress: true});
|
||||
await client.updateAttributes({hasToInvoiceByAddress: true});
|
||||
});
|
||||
|
||||
it('should propagate the isEqualizated on both addresses of Mr Wayne and set hasToInvoiceByAddress to false', async() => {
|
||||
|
|
|
@ -32,10 +32,6 @@ describe('Client updateBasicData', () => {
|
|||
|
||||
let result = await app.models.Client.updateBasicData(validparams, id);
|
||||
|
||||
expect(result).toEqual({count: 1});
|
||||
|
||||
let updatedClient = await app.models.Client.findById(101);
|
||||
|
||||
expect(updatedClient.email).toEqual('myNewEmail@myDomain.es');
|
||||
expect(result.email).toEqual('myNewEmail@myDomain.es');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -50,10 +50,6 @@ describe('Client updateFiscalData', () => {
|
|||
|
||||
let result = await app.models.Client.updateFiscalData(ctxOfAdmin, validparams, idWithDataChecked);
|
||||
|
||||
expect(result).toEqual({count: 1});
|
||||
|
||||
let updatedClient = await app.models.Client.findById(idWithDataChecked);
|
||||
|
||||
expect(updatedClient.postcode).toEqual('12345');
|
||||
expect(result.postcode).toEqual('12345');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -43,7 +43,7 @@ module.exports = Self => {
|
|||
if (validUpdateParams.indexOf(key) === -1)
|
||||
throw new UserError(`You don't have enough privileges to do that`);
|
||||
}
|
||||
|
||||
return await Self.app.models.Client.update({id: id}, params);
|
||||
let client = await Self.app.models.Client.findById(id);
|
||||
return await client.updateAttributes(params);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -61,6 +61,8 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
params.id = id;
|
||||
return await Self.app.models.Client.update({id: id}, params);
|
||||
|
||||
let client = await Self.app.models.Client.findById(id);
|
||||
return await client.updateAttributes(params);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -125,8 +125,13 @@ module.exports = function(Self) {
|
|||
Object.assign(newInstance, ctx.hookState.newInstance)
|
||||
}
|
||||
|
||||
|
||||
let userFk;
|
||||
if (!loopBackContext) userFk = 9;
|
||||
else userFk = loopBackContext.active.accessToken.userId;
|
||||
|
||||
let action = setActionType(ctx);
|
||||
let userFk = loopBackContext.active.accessToken.userId;
|
||||
|
||||
|
||||
let logRecord = {
|
||||
originFk: originId,
|
||||
|
|
Loading…
Reference in New Issue