mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-19 12:19:16 +00:00
improvement: change code execution order in some services
This commit is contained in:
@@ -21,6 +21,12 @@ const ListMessagesService = async ({
|
||||
pageNumber = "1",
|
||||
ticketId
|
||||
}: Request): Promise<Response> => {
|
||||
const ticket = await ShowTicketService(ticketId);
|
||||
|
||||
if (!ticket) {
|
||||
throw new Error("No ticket found with this ID");
|
||||
}
|
||||
|
||||
const whereCondition = {
|
||||
body: where(
|
||||
fn("LOWER", col("body")),
|
||||
@@ -30,12 +36,6 @@ const ListMessagesService = async ({
|
||||
ticketId
|
||||
};
|
||||
|
||||
const ticket = await ShowTicketService(ticketId);
|
||||
|
||||
if (!ticket) {
|
||||
throw new Error("No ticket found with this ID");
|
||||
}
|
||||
|
||||
// await setMessagesAsRead(ticket);
|
||||
const limit = 20;
|
||||
const offset = limit * (+pageNumber - 1);
|
||||
|
||||
Reference in New Issue
Block a user