From 2d1c8647da5e4edebb3c350fabda39c8dd1add32 Mon Sep 17 00:00:00 2001 From: Rafael Lopes Date: Tue, 16 Dec 2025 11:50:50 -0300 Subject: [PATCH] =?UTF-8?q?FIX:=20Refatorar=20l=C3=B3gica=20de=20verifica?= =?UTF-8?q?=C3=A7=C3=A3o=20de=20escopo=20em=20handleTicket=20para=20usar?= =?UTF-8?q?=20array=20de=20palavras-chave?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/ticketService.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/services/ticketService.js b/src/services/ticketService.js index c2547ce..3d5fef4 100644 --- a/src/services/ticketService.js +++ b/src/services/ticketService.js @@ -17,7 +17,16 @@ const e = require('express'); const handleTicket = async (glpiTicketId, ticketTitle) => { try { - if (!tolow(ticketTitle).includes("mundiale") || !tolow(ticketTitle).includes("implantacao") || !tolow(ticketTitle).includes("sac") || !tolow(ticketTitle).includes('cancelamento') || !tolow(ticketTitle).includes('troca de titularidade')) { + const keywords = [ + "mundiale", "implantacao", "implantação", "sac", + "cancelamento", "troca de titularidade" + ]; + + const lowerCaseTitle = ticketTitle.toLowerCase(); + + const isInScope = keywords.some(keyword => lowerCaseTitle.includes(keyword)); + + if (!isInScope) { logInfo(`Ticket ID ${glpiTicketId} esta fora do escopo do fluxo. Ignorando fechamento.`); return null; }