Tarea #600 Refactor to make it compatible with logs
This commit is contained in:
parent
a607ac9efb
commit
5eb83ed01e
|
@ -1,5 +1,5 @@
|
|||
module.exports = function(Client) {
|
||||
Client.remoteMethod('addressesPropagateRe', {
|
||||
module.exports = function(Self) {
|
||||
Self.remoteMethod('addressesPropagateRe', {
|
||||
description: 'Change property isEqualizated in all client addresses',
|
||||
accessType: 'WRITE',
|
||||
accepts: [
|
||||
|
@ -29,10 +29,11 @@ module.exports = function(Client) {
|
|||
}
|
||||
});
|
||||
|
||||
Client.addressesPropagateRe = async (id, data) => {
|
||||
Self.addressesPropagateRe = async (id, data) => {
|
||||
if (data.hasOwnProperty('isEqualizated')) {
|
||||
await Client.app.models.Address.updateAll({clientFk: id}, data);
|
||||
await Client.update({id: id}, {hasToInvoiceByAddress: false});
|
||||
await Self.app.models.Address.updateAll({clientFk: id}, data);
|
||||
let client = await Self.app.models.Client.findById(id)
|
||||
await client.updateAttributes({hasToInvoiceByAddress: false});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue