diff --git a/backend/src/services/WbotServices/wbotMessageListener.ts b/backend/src/services/WbotServices/wbotMessageListener.ts index abdefd0..98f0d02 100644 --- a/backend/src/services/WbotServices/wbotMessageListener.ts +++ b/backend/src/services/WbotServices/wbotMessageListener.ts @@ -23,6 +23,7 @@ import { Op } from "sequelize"; import moment from "moment"; import { Transform } from "stream"; import { Throttle } from "stream-throttle"; +import { Sequelize } from "sequelize-typescript"; import Contact from "../../models/Contact"; import Ticket from "../../models/Ticket"; import Message from "../../models/Message"; @@ -1348,8 +1349,8 @@ const handleChartbot = async (ticket: Ticket, msg: WAMessage, wbot: Session, don } ], order: [ - ["forwardQueue", "options", "option", "ASC"], - ["options", "option", "ASC"], + [Sequelize.cast(Sequelize.col("forwardQueue.options.option"), "INTEGER"), "ASC"], + [Sequelize.cast(Sequelize.col("options.option"), "INTEGER"), "ASC"] ] }); diff --git a/backend/src/services/WhatsappService/ShowWhatsAppService.ts b/backend/src/services/WhatsappService/ShowWhatsAppService.ts index 56e4050..6e4f968 100644 --- a/backend/src/services/WhatsappService/ShowWhatsAppService.ts +++ b/backend/src/services/WhatsappService/ShowWhatsAppService.ts @@ -1,4 +1,5 @@ import { FindOptions } from "sequelize/types"; +import { Sequelize } from "sequelize-typescript"; import Whatsapp from "../../models/Whatsapp"; import AppError from "../../errors/AppError"; import Queue from "../../models/Queue"; @@ -28,14 +29,14 @@ const ShowWhatsAppService = async ( model: QueueOption, as: "options", required: false, - where: { parentId: null } + where: { parentId: null }, } ] } ], order: [ ["queues", "name", "ASC"], - ["queues", "options", "option", "ASC"] + [Sequelize.cast(Sequelize.col("queues.options.option"), "INTEGER"), "ASC"] ] };