Correção de bug quando o usuario clicar no botao retornar o atendimento para a fila

pull/20/head
adriano 2022-09-05 13:36:42 -03:00
parent 8b370e01f6
commit 55e83ff8fc
1 changed files with 18 additions and 14 deletions

View File

@ -50,7 +50,7 @@ import CountTicketService from "../services/TicketServices/CountTicketService";
import CountTicketsByUserQueue from "../services/UserServices/CountTicketsByUserQueue"; import CountTicketsByUserQueue from "../services/UserServices/CountTicketsByUserQueue";
import ShowUserService from "../services/UserServices/ShowUserService"; import ShowUserService from "../services/UserServices/ShowUserService";
export const index = async (req: Request, res: Response): Promise<Response> => { export const index = async (req: Request, res: Response): Promise<Response> => {
const { const {
pageNumber, pageNumber,
@ -61,7 +61,7 @@ export const index = async (req: Request, res: Response): Promise<Response> => {
queueIds: queueIdsStringified, queueIds: queueIdsStringified,
withUnreadMessages, withUnreadMessages,
unlimited unlimited
} = req.query as IndexQuery; } = req.query as IndexQuery;
const userId = req.user.id; const userId = req.user.id;
@ -104,7 +104,7 @@ export const store = async (req: Request, res: Response): Promise<Response> => {
console.log('TICKET QUEUE CHOICE !!!!!!!') console.log('TICKET QUEUE CHOICE !!!!!!!')
} }
else { else {
ticket = await CreateTicketService({ contactId, status, userId }); ticket = await CreateTicketService({ contactId, status, userId });
} }
const io = getIO(); const io = getIO();
@ -143,14 +143,14 @@ export const show = async (req: Request, res: Response): Promise<Response> => {
}; };
export const count = async (req: Request, res: Response): Promise<Response> => { export const count = async (req: Request, res: Response): Promise<Response> => {
type indexQ = { status: string; date?: string; }; type indexQ = { status: string; date?: string; };
const {status, date} = req.query as IndexQuery const { status, date } = req.query as IndexQuery
const ticketCount = await CountTicketService(status, date); const ticketCount = await CountTicketService(status, date);
return res.status(200).json(ticketCount); return res.status(200).json(ticketCount);
}; };
@ -237,15 +237,19 @@ export const update = async (req: Request, res: Response): Promise<Response> =>
ticketId ticketId
}); });
const dateToday = splitDateTime(new Date(format(new Date(), 'yyyy-MM-dd HH:mm:ss', { locale: ptBR }))) if (ticketData.userId) {
TicketEmiterSumOpenClosedByUser(ticketData.userId.toString(), dateToday.fullDate, dateToday.fullDate)
const dateToday = splitDateTime(new Date(format(new Date(), 'yyyy-MM-dd HH:mm:ss', { locale: ptBR })))
TicketEmiterSumOpenClosedByUser(ticketData.userId.toString(), dateToday.fullDate, dateToday.fullDate)
}
ticket2 = ticket ticket2 = ticket
} }
if (userOldInfo) { if (userOldInfo) {
@ -255,13 +259,13 @@ export const update = async (req: Request, res: Response): Promise<Response> =>
// console.log('FECHOU...') // console.log('FECHOU...')
TicketEmiterSumOpenClosedByUser(userOldInfo.userId.toString(), dateToday.fullDate, dateToday.fullDate) TicketEmiterSumOpenClosedByUser(userOldInfo.userId.toString(), dateToday.fullDate, dateToday.fullDate)
} }
} }
return res.status(200).json(ticket2); return res.status(200).json(ticket2);
}; };