feat: finished queue filter on tickets list

This commit is contained in:
canove
2021-01-13 19:43:50 -03:00
parent c61c993572
commit 2c2a39ee1f
6 changed files with 124 additions and 134 deletions

View File

@@ -63,7 +63,7 @@ export const store = async (req: Request, res: Response): Promise<Response> => {
const io = getIO();
io.to(ticket.status).emit("ticket", {
action: "create",
action: "update",
ticket
});
@@ -100,7 +100,7 @@ export const update = async (
}
io.to(ticket.status).to("notification").to(ticketId).emit("ticket", {
action: "updateStatus",
action: "update",
ticket
});

View File

@@ -34,12 +34,6 @@ const ListTicketsService = async ({
userId,
withUnreadMessages
}: Request): Promise<Response> => {
// const user = await ShowUserService(userId);
// const userQueueIds = user.queues.map(queue => queue.id);
// console.log(userQueueIds);
let whereCondition: Filterable["where"] = {
[Op.or]: [{ userId }, { status: "pending" }],
queueId: { [Op.or]: [queueIds, null] }
@@ -60,7 +54,7 @@ const ListTicketsService = async ({
];
if (showAll === "true") {
whereCondition = {};
whereCondition = { queueId: { [Op.or]: [queueIds, null] } };
}
if (status) {
@@ -92,6 +86,7 @@ const ListTicketsService = async ({
];
whereCondition = {
...whereCondition,
[Op.or]: [
{
"$contact.name$": where(