diff --git a/front/nginx.conf b/front/nginx.conf index d6205af1e..84daf2ef2 100644 --- a/front/nginx.conf +++ b/front/nginx.conf @@ -1,4 +1,12 @@ +set_real_ip_from 0.0.0.0/0; +real_ip_header X-Forwarded-For; +log_format upstreamlog + '[$time_local] $remote_addr -> $proxy_host:$upstream_addr ' + '"$request" $status $body_bytes_sent ' + '"$http_referer" "$http_user_agent"'; +access_log /var/log/nginx/access.log upstreamlog; + upstream back { server back_1:3000; server back_2:3000; diff --git a/modules/claim/back/methods/claim/regularizeClaim.js b/modules/claim/back/methods/claim/regularizeClaim.js index 8a897ba5c..8ae47a3fa 100644 --- a/modules/claim/back/methods/claim/regularizeClaim.js +++ b/modules/claim/back/methods/claim/regularizeClaim.js @@ -70,14 +70,16 @@ module.exports = Self => { discount: 100 }, {transaction: transaction}); - await sendMessage(ctx, { - itemFk: sale.itemFk, - ticketFk: sale.ticketFk, - recipientFk: sale.item().itemType().worker().userFk, - quantity: sale.quantity, - concept: sale.concept, - nickname: address.nickname - }, transaction); + if (sale.ticket().client().salesPerson()) { + await sendMessage(ctx, { + itemFk: sale.itemFk, + ticketFk: sale.ticketFk, + recipientFk: sale.ticket().client().salesPerson().userFk, + quantity: sale.quantity, + concept: sale.concept, + nickname: address.nickname + }, transaction); + } } let claim = await Self.findById(params.claimFk); @@ -99,23 +101,14 @@ module.exports = Self => { include: [ { relation: 'ticket', - scope: {fields: ['warehouseFk', 'companyFk']} - }, - { - relation: 'item', scope: { - fields: ['typeFk'], + fields: ['clientFk', 'warehouseFk', 'companyFk'], include: { - relation: 'itemType', + relation: 'client', scope: { - fields: ['workerFk'], include: { - relation: 'worker', - scope: { - fields: ['id', 'userFk'], - } + relation: 'salesPerson' } - } } } diff --git a/modules/item/back/methods/item/filter.js b/modules/item/back/methods/item/filter.js index 876ca4354..05cd87ca2 100644 --- a/modules/item/back/methods/item/filter.js +++ b/modules/item/back/methods/item/filter.js @@ -73,7 +73,7 @@ module.exports = Self => { case 'search': return /^\d+$/.test(value) ? {or: [{'i.id': value}, {'ib.code': value}]} - : {'i.name': {like: `%${value}%`}}; + : {or: [{'i.name': {like: `%${value}%`}}, {'ib.code': value}]}; case 'id': return {'i.id': value}; case 'description':