feat: add queue filter to tickets list

This commit is contained in:
canove
2021-01-13 12:22:43 -03:00
parent ef6291c48d
commit aac6d30083
9 changed files with 160 additions and 24 deletions

View File

@@ -14,6 +14,7 @@ type IndexQuery = {
date: string;
showAll: string;
withUnreadMessages: string;
queueIds: string;
};
interface TicketData {
@@ -29,11 +30,18 @@ export const index = async (req: Request, res: Response): Promise<Response> => {
date,
searchParam,
showAll,
queueIds: queueIdsStringified,
withUnreadMessages
} = req.query as IndexQuery;
const userId = req.user.id;
let queueIds: number[] = [];
if (queueIdsStringified) {
queueIds = JSON.parse(queueIdsStringified);
}
const { tickets, count, hasMore } = await ListTicketsService({
searchParam,
pageNumber,
@@ -41,6 +49,7 @@ export const index = async (req: Request, res: Response): Promise<Response> => {
date,
showAll,
userId,
queueIds,
withUnreadMessages
});