Correção para quando transferir atendimento

adriano 2023-06-30 15:21:30 -03:00
parent 64cd155016
commit 605e4035b9
2 changed files with 15 additions and 6 deletions

View File

@ -45,6 +45,7 @@ interface TicketData {
userId: number;
whatsappId?: string | number
msg?: string,
transfer?: boolean | undefined
}
@ -226,18 +227,25 @@ export const update = async (req: Request, res: Response): Promise<Response> =>
let ticketData: TicketData = req.body;
const defaultWhatsapp: any = await GetDefaultWhatsApp(ticketData.userId);
console.log('ticketData: ', ticketData)
console.log('ticketData.transfer', ticketData.transfer)
const _ticket: any = await Ticket.findByPk(ticketId)
if (ticketData.transfer) {
if (defaultWhatsapp && ticketData.status != 'open') {
const defaultWhatsapp: any = await GetDefaultWhatsApp(ticketData.userId);
await CheckContactOpenTickets(_ticket.dataValues.contactId, defaultWhatsapp.dataValues.id)
const _ticket: any = await Ticket.findByPk(ticketId)
if (defaultWhatsapp && ticketData.status != 'open') {
await CheckContactOpenTickets(_ticket.dataValues.contactId, defaultWhatsapp.dataValues.id)
}
ticketData.whatsappId = defaultWhatsapp.dataValues.id
}
ticketData.whatsappId = defaultWhatsapp.dataValues.id
const { ticket } = await UpdateTicketService({
ticketData,
ticketId,

View File

@ -109,6 +109,7 @@ const TransferTicketModal = ({ modalOpen, onClose, ticketid }) => {
// test del PARA APARECER NA FILA DE OUTRO ATENDENTE E O MESMO CLICAR EM ACEITAR AO INVES DE ENVIAR PARA ATENDENDO
data.status = 'pending'
data.transfer = true
await api.put(`/tickets/${ticketid}`, data);