feat: redundant role removal and service import

adriano 2024-04-03 15:04:51 -03:00
parent 20a45b6210
commit d6ec5972a5
2 changed files with 11 additions and 13 deletions

View File

@ -94,9 +94,6 @@ export async function findByContain(
}
return results;
}
export async function del(key: string) {
await redis.del(key);
}
export async function createObject({
whatsappId,

View File

@ -85,7 +85,6 @@ import {
} from "../../helpers/WhatsappIdMultiSessionControl";
import AppError from "../../errors/AppError";
import { setMessageAsRead } from "../../helpers/SetMessageAsRead";
import FindOrCreateTicketServiceBot from "../TicketServices/FindOrCreateTicketServiceBot";
import { getSettingValue } from "../../helpers/WhaticketSettings";
import { Op, json } from "sequelize";
@ -95,10 +94,12 @@ import mostRepeatedPhrase from "../../helpers/MostRepeatedPhrase";
import ListWhatsAppsNumber from "../WhatsappService/ListWhatsAppsNumber";
import {
createObject,
del,
findByContain,
findObject,
get,
getSimple
getSimple,
set
} from "../../helpers/RedisClient";
import FindOrCreateTicketServiceBot from "../TicketServices/FindOrCreateTicketServiceBot";
import ShowTicketService from "../TicketServices/ShowTicketService";
@ -106,6 +107,7 @@ import ShowQueuesByUser from "../UserServices/ShowQueuesByUser";
import ListWhatsappQueuesByUserQueue from "../UserServices/ListWhatsappQueuesByUserQueue";
import CreateContactService from "../ContactServices/CreateContactService";
import { number } from "yup";
import ShowContactCustomFieldService from "../ContactServices/ShowContactCustomFieldsService";
var lst: any[] = getWhatsappIds();
@ -1199,9 +1201,9 @@ const handleMessage = async (
return;
}
let query = await get(
`whatsappId:${wbot.id}:contactId:${contact?.id}:identifier:query`
);
let query = await get({
key: `whatsappId:${wbot.id}:contactId:${contact?.id}:identifier:query`
});
if (query && msg?.body?.trim() != "0") {
query = JSON.parse(query);
@ -1219,7 +1221,6 @@ const handleMessage = async (
await set(
`whatsappId:${wbot.id}:contactId:${contact?.id}:identifier:query`,
JSON.stringify({ ...query, value: msg.body }),
true
);
}
@ -1265,7 +1266,6 @@ dialog_actions=request_endpoint=https://sos.espacolaser.com.br/api/whatsapp/tick
queryMsgInvalidParam: menuMsg?.queryMsgInvalidParam,
optionsMenu: menuMsg?.optionsMenu
}),
true
);
}
}
@ -1459,7 +1459,8 @@ const menu = async (userTyped: string, whatsappId: any, contactId: any) => {
whatsappId,
contactId,
identifier: "ura",
value: data[1].id
value: data[1].id,
history: `|${data[1].id}`
});
await del(