From 8be929c1da19a3da489f2823a058b8325b196580 Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Wed, 27 May 2020 08:07:14 +0200 Subject: [PATCH] log tiquet request --- .../ticket/back/methods/ticket-request/confirm.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/ticket/back/methods/ticket-request/confirm.js b/modules/ticket/back/methods/ticket-request/confirm.js index fe08794f1..d1c50d00a 100644 --- a/modules/ticket/back/methods/ticket-request/confirm.js +++ b/modules/ticket/back/methods/ticket-request/confirm.js @@ -31,6 +31,7 @@ module.exports = Self => { }); Self.confirm = async ctx => { + const userId = ctx.req.accessToken.userId; const models = Self.app.models; const tx = await Self.beginTransaction({}); const $t = ctx.req.__; // $translate @@ -92,6 +93,20 @@ module.exports = Self => { }); await models.Chat.sendCheckingPresence(ctx, requesterId, message); + // loguejar + let logRecord = { + originFk: sale.ticketFk, + userFk: userId, + action: 'update', + changedModel: 'ticketRequest', + newInstance: { + destinationFk: sale.ticketFk, + message: message + } + }; + + await Self.app.models.TicketLog.create(logRecord); + await tx.commit(); return sale;