fix: Fix bug in ticket transfer from selected user's queue by agent

feat-scaling-ticket-remote-creation
adriano 2024-02-22 15:20:26 -03:00
parent d25d296498
commit 7fc0f136ff
3 changed files with 17 additions and 6 deletions

View File

@ -99,7 +99,7 @@ export const index = async (req: Request, res: Response): Promise<Response> => {
// };
export const all = async (req: Request, res: Response): Promise<Response> => {
const { userId, profile } = req.query as IndexQuery;
let { userId, profile }: any = req.query as IndexQuery;
console.log(
"userId: ",
@ -111,6 +111,9 @@ export const all = async (req: Request, res: Response): Promise<Response> => {
);
if (getSettingValue("queueTransferByWhatsappScope")?.value == "enabled") {
if (!userId) return res.json({ users: [], queues: [] });
const obj = await ListUserByWhatsappQueuesService(
userId,
'"admin", "user", "supervisor"'

View File

@ -2,7 +2,7 @@ import { Op, Sequelize } from "sequelize";
import Queue from "../../models/Queue";
import User from "../../models/User";
import UserQueue from "../../models/UserQueue";
import { List } from "whatsapp-web.js"
import { List } from "whatsapp-web.js";
interface Request {
userId?: string | number;
@ -12,7 +12,13 @@ interface Request {
userIds?: string | number;
}
const ListUser = async ({ profile, userId, raw, userIds, profiles }: Request): Promise<User[]> => {
const ListUser = async ({
profile,
userId,
raw,
userIds,
profiles
}: Request): Promise<User[]> => {
let where_clause = {};
if (userId && profile) {
@ -47,7 +53,7 @@ const ListUser = async ({ profile, userId, raw, userIds, profiles }: Request): P
],
order: [["id", "ASC"]],
group: ["User.id"]
group: userIds ? undefined : ["User.id"]
});
return users;

View File

@ -195,6 +195,8 @@ const TransferTicketModal = ({ modalOpen, onClose, ticketid }) => {
params: { userId: user.id },
})
console.log('data.queues: ', data.queues, ' | data.users: ', data.users)
setUsers(data.users)
setQueuesByWhats(data.queues)
setQueues(data.queues)