Skip to content

Commit

Permalink
fix queue options order - fix #208
Browse files Browse the repository at this point in the history
  • Loading branch information
allgood committed Nov 10, 2024
1 parent 9a5b0f4 commit 45ceebd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions backend/src/services/WbotServices/wbotMessageListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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"]
]
});

Expand Down
5 changes: 3 additions & 2 deletions backend/src/services/WhatsappService/ShowWhatsAppService.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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"]
]
};

Expand Down

0 comments on commit 45ceebd

Please sign in to comment.