From a725dfeb97949e256565200e8a2f0bff7791bcf1 Mon Sep 17 00:00:00 2001 From: Robson Tenorio Date: Wed, 23 Mar 2022 09:57:10 -0300 Subject: [PATCH] =?UTF-8?q?Corre=C3=A7=C3=A3o=20de=20tela=20branca=20ao=20?= =?UTF-8?q?receber=20mensagens?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/MessageServices/CreateMessageService.ts | 10 +++++++++- .../src/services/TicketServices/ShowTicketService.ts | 6 ++++++ frontend/src/components/TicketListItem/index.js | 10 +++++----- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/backend/src/services/MessageServices/CreateMessageService.ts b/backend/src/services/MessageServices/CreateMessageService.ts index 67fd33b5..2bfd9c72 100644 --- a/backend/src/services/MessageServices/CreateMessageService.ts +++ b/backend/src/services/MessageServices/CreateMessageService.ts @@ -1,6 +1,7 @@ import { getIO } from "../../libs/socket"; import Message from "../../models/Message"; import Ticket from "../../models/Ticket"; +import Whatsapp from "../../models/Whatsapp"; interface MessageData { id: string; @@ -27,7 +28,14 @@ const CreateMessageService = async ({ { model: Ticket, as: "ticket", - include: ["contact", "queue"] + include: [ + "contact", "queue", + { + model: Whatsapp, + as: "whatsapp", + attributes: ["name"] + } + ] }, { model: Message, diff --git a/backend/src/services/TicketServices/ShowTicketService.ts b/backend/src/services/TicketServices/ShowTicketService.ts index 5efab0ca..06440661 100644 --- a/backend/src/services/TicketServices/ShowTicketService.ts +++ b/backend/src/services/TicketServices/ShowTicketService.ts @@ -3,6 +3,7 @@ import AppError from "../../errors/AppError"; import Contact from "../../models/Contact"; import User from "../../models/User"; import Queue from "../../models/Queue"; +import Whatsapp from "../../models/Whatsapp"; const ShowTicketService = async (id: string | number): Promise => { const ticket = await Ticket.findByPk(id, { @@ -22,6 +23,11 @@ const ShowTicketService = async (id: string | number): Promise => { model: Queue, as: "queue", attributes: ["id", "name", "color"] + }, + { + model: Whatsapp, + as: "whatsapp", + attributes: ["name"] } ] }); diff --git a/frontend/src/components/TicketListItem/index.js b/frontend/src/components/TicketListItem/index.js index d0fc01b2..b9c7d302 100644 --- a/frontend/src/components/TicketListItem/index.js +++ b/frontend/src/components/TicketListItem/index.js @@ -102,9 +102,9 @@ const useStyles = makeStyles(theme => ({ userTag: { position: "absolute", - marginRight: 5, - right: 5, - bottom: 5, + marginRight: 35, + right: 10, + bottom: 9, background:"#2576D2", color: "#ffffff", border:"1px solid #CCC", @@ -112,7 +112,7 @@ const useStyles = makeStyles(theme => ({ paddingLeft: 5, paddingRight: 5, borderRadius: 10, - fontSize: "1em" + fontSize: "0.9em" }, })); @@ -211,7 +211,7 @@ const TicketListItem = ({ ticket }) => { )} )} - {ticket.whatsappId && ( + {ticket?.whatsappId && (
{ticket.whatsapp.name}
)}