Compare commits

..

No commits in common. "ec6e84f56739d7d424f933258d27eafe69f0e782" and "2fc732eec17dd9d18fbeacb7bea4daaf8712f798" have entirely different histories.

3 changed files with 9 additions and 15 deletions

View File

@ -12,7 +12,7 @@ import DeleteUserService from "../services/UserServices/DeleteUserService";
import ListUser from "../services/UserServices/ListUserParamiterService"; import ListUser from "../services/UserServices/ListUserParamiterService";
import User from "../models/User"; import User from "../models/User";
import { del, get, set } from "../helpers/RedisClient"; import { get, set } from "../helpers/RedisClient";
import { import {
startWhoIsOnlineMonitor, startWhoIsOnlineMonitor,
@ -27,7 +27,7 @@ import { splitDateTime } from "../helpers/SplitDateTime";
import ListUserByWhatsappQueuesService from "../services/UserServices/ListUserByWhatsappQueuesService"; import ListUserByWhatsappQueuesService from "../services/UserServices/ListUserByWhatsappQueuesService";
import { json } from "sequelize"; import { json } from "sequelize";
import { getSettingValue } from "../helpers/WhaticketSettings"; import { getSettingValue } from "../helpers/WhaticketSettings";
import { setBotInfo } from "../helpers/SetBotInfo"; import { setBotInfo } from "../helpers/SetBotInfo"
type IndexQuery = { type IndexQuery = {
searchParam: string; searchParam: string;
@ -275,7 +275,7 @@ export const update = async (
let user: any = await UpdateUserService({ userData, userId }); let user: any = await UpdateUserService({ userData, userId });
await setBotInfo(user); await setBotInfo(user)
if (user) { if (user) {
const { id, name } = user; const { id, name } = user;
@ -305,8 +305,6 @@ export const remove = async (
await DeleteUserService(userId); await DeleteUserService(userId);
del(`user:${userId}`);
const io = getIO(); const io = getIO();
io.emit("user", { io.emit("user", {
action: "delete", action: "delete",
@ -326,3 +324,5 @@ export const remove = async (
return res.status(200).json({ message: "User deleted" }); return res.status(200).json({ message: "User deleted" });
}; };

View File

@ -42,7 +42,7 @@ import { getSettingValue } from "../helpers/WhaticketSettings";
import ListWhatsAppsNumber from "../services/WhatsappService/ListWhatsAppsNumber"; import ListWhatsAppsNumber from "../services/WhatsappService/ListWhatsAppsNumber";
import SettingTicket from "../models/SettingTicket"; import SettingTicket from "../models/SettingTicket";
import { Op } from "sequelize"; import { Op } from "sequelize";
import { del, get, set } from "../helpers/RedisClient"; import { get, set } from "../helpers/RedisClient";
interface WhatsappData { interface WhatsappData {
name: string; name: string;
@ -230,9 +230,9 @@ export const weebhook = async (
req.body.entry[0].changes[0].value.metadata.display_phone_number; req.body.entry[0].changes[0].value.metadata.display_phone_number;
let type = message.type; let type = message.type;
const contact_to_exist = await get("whatsapp:*", `${contact_to}`); const contact_from_exist = await get("whatsapp:*", `${contact_from}`);
if (contact_to_exist == null) { if (!contact_from_exist) {
console.log( console.log(
"WHATSAPP OFFICIAL", "WHATSAPP OFFICIAL",
" | CONCTACT_FROM: ", " | CONCTACT_FROM: ",
@ -514,8 +514,6 @@ export const remove = async (
}); });
} }
await del(`whatsapp:${whatsappId}`);
let whats = await ListWhatsAppsNumber(whatsappId); let whats = await ListWhatsAppsNumber(whatsappId);
// Remove tickets business hours config // Remove tickets business hours config

View File

@ -23,7 +23,7 @@ export async function get(key: string, value?: string) {
if (keys.length > 0) { if (keys.length > 0) {
for (const key of keys) { for (const key of keys) {
const val = await redis.get(key); const val = await redis.get(key);
if (value == val) return value; if (value == val) return value;
} }
} }
return null; return null;
@ -33,10 +33,6 @@ export async function get(key: string, value?: string) {
} }
} }
export async function del(key: string) {
await redis.del(key);
}
export async function clearAllKeys(...keys: string[]) { export async function clearAllKeys(...keys: string[]) {
for (const key of keys) { for (const key of keys) {
// Retrieve all keys matching the pattern '*' // Retrieve all keys matching the pattern '*'