From 9abaa8ce51097f0a0f4982a9030332e383f29db8 Mon Sep 17 00:00:00 2001 From: Gerard Date: Thu, 4 Apr 2019 12:05:01 +0200 Subject: [PATCH] bug sending messages to buyers fixed --- .../claim/back/methods/claim/regularizeClaim.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/claim/back/methods/claim/regularizeClaim.js b/modules/claim/back/methods/claim/regularizeClaim.js index 60a319359..8a897ba5c 100644 --- a/modules/claim/back/methods/claim/regularizeClaim.js +++ b/modules/claim/back/methods/claim/regularizeClaim.js @@ -73,7 +73,7 @@ module.exports = Self => { await sendMessage(ctx, { itemFk: sale.itemFk, ticketFk: sale.ticketFk, - workerFk: sale.item().itemType().workerFk, + recipientFk: sale.item().itemType().worker().userFk, quantity: sale.quantity, concept: sale.concept, nickname: address.nickname @@ -107,7 +107,16 @@ module.exports = Self => { fields: ['typeFk'], include: { relation: 'itemType', - scope: {fields: ['workerFk']} + scope: { + fields: ['workerFk'], + include: { + relation: 'worker', + scope: { + fields: ['id', 'userFk'], + } + } + + } } } }], @@ -152,7 +161,7 @@ module.exports = Self => { + `"${params.nickname}" provenientes del ticket #${params.ticketFk}`; await Self.app.models.Message.send(ctx, { - recipientFk: params.workerFk, + recipientFk: params.recipientFk, message: message }, {transaction: transaction}); }