Compare commits
No commits in common. "05dd0e60c0f8ed4c9aefeb8cfc05ab983d6601c5" and "d25d296498d0a74413da6209894150622dc24287" have entirely different histories.
05dd0e60c0
...
d25d296498
|
@ -99,7 +99,7 @@ export const index = async (req: Request, res: Response): Promise<Response> => {
|
||||||
// };
|
// };
|
||||||
|
|
||||||
export const all = async (req: Request, res: Response): Promise<Response> => {
|
export const all = async (req: Request, res: Response): Promise<Response> => {
|
||||||
let { userId, profile }: any = req.query as IndexQuery;
|
const { userId, profile } = req.query as IndexQuery;
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
"userId: ",
|
"userId: ",
|
||||||
|
@ -110,10 +110,7 @@ export const all = async (req: Request, res: Response): Promise<Response> => {
|
||||||
getSettingValue("queueTransferByWhatsappScope")?.value
|
getSettingValue("queueTransferByWhatsappScope")?.value
|
||||||
);
|
);
|
||||||
|
|
||||||
if (getSettingValue("queueTransferByWhatsappScope")?.value == "enabled") {
|
if (getSettingValue("queueTransferByWhatsappScope")?.value == "enabled") {
|
||||||
|
|
||||||
if (!userId) return res.json({ users: [], queues: [] });
|
|
||||||
|
|
||||||
const obj = await ListUserByWhatsappQueuesService(
|
const obj = await ListUserByWhatsappQueuesService(
|
||||||
userId,
|
userId,
|
||||||
'"admin", "user", "supervisor"'
|
'"admin", "user", "supervisor"'
|
||||||
|
@ -122,7 +119,7 @@ export const all = async (req: Request, res: Response): Promise<Response> => {
|
||||||
const usersByWhatsqueue = obj.users;
|
const usersByWhatsqueue = obj.users;
|
||||||
const queues = obj.queues;
|
const queues = obj.queues;
|
||||||
|
|
||||||
let userIds = usersByWhatsqueue.map((w: any) => w.userId);
|
let userIds = usersByWhatsqueue.map((w: any) => w.userId);
|
||||||
|
|
||||||
const users = await ListUser({
|
const users = await ListUser({
|
||||||
userIds
|
userIds
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Op, Sequelize } from "sequelize";
|
||||||
import Queue from "../../models/Queue";
|
import Queue from "../../models/Queue";
|
||||||
import User from "../../models/User";
|
import User from "../../models/User";
|
||||||
import UserQueue from "../../models/UserQueue";
|
import UserQueue from "../../models/UserQueue";
|
||||||
import { List } from "whatsapp-web.js";
|
import { List } from "whatsapp-web.js"
|
||||||
|
|
||||||
interface Request {
|
interface Request {
|
||||||
userId?: string | number;
|
userId?: string | number;
|
||||||
|
@ -12,13 +12,7 @@ interface Request {
|
||||||
userIds?: string | number;
|
userIds?: string | number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ListUser = async ({
|
const ListUser = async ({ profile, userId, raw, userIds, profiles }: Request): Promise<User[]> => {
|
||||||
profile,
|
|
||||||
userId,
|
|
||||||
raw,
|
|
||||||
userIds,
|
|
||||||
profiles
|
|
||||||
}: Request): Promise<User[]> => {
|
|
||||||
let where_clause = {};
|
let where_clause = {};
|
||||||
|
|
||||||
if (userId && profile) {
|
if (userId && profile) {
|
||||||
|
@ -53,7 +47,7 @@ const ListUser = async ({
|
||||||
],
|
],
|
||||||
|
|
||||||
order: [["id", "ASC"]],
|
order: [["id", "ASC"]],
|
||||||
group: userIds ? undefined : ["User.id"]
|
group: ["User.id"]
|
||||||
});
|
});
|
||||||
|
|
||||||
return users;
|
return users;
|
||||||
|
|
|
@ -194,7 +194,7 @@ const TransferTicketModal = ({ modalOpen, onClose, ticketid }) => {
|
||||||
const { data } = await api.get(`/users/all`, {
|
const { data } = await api.get(`/users/all`, {
|
||||||
params: { userId: user.id },
|
params: { userId: user.id },
|
||||||
})
|
})
|
||||||
|
|
||||||
setUsers(data.users)
|
setUsers(data.users)
|
||||||
setQueuesByWhats(data.queues)
|
setQueuesByWhats(data.queues)
|
||||||
setQueues(data.queues)
|
setQueues(data.queues)
|
||||||
|
|
Loading…
Reference in New Issue