Skip to content

Commit

Permalink
fix: Ajuste no tratamento do horário de atendimento > Necessário que …
Browse files Browse the repository at this point in the history
…o usuário para a sincronização do timezone no servidor e banco de dados, atualmente isso não é suportado pela aplicação.

fix #87 Regras de horário de atendimento
  • Loading branch information
ldurans committed Dec 19, 2022
1 parent 2ec563b commit f5500d4
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
import { IgApiClientMQTT, MessageSyncMessageWrapper } from "instagram_mqtt";
import VerifyStepsChatFlowTicket from "../ChatFlowServices/VerifyStepsChatFlowTicket";
import FindOrCreateTicketService from "../TicketServices/FindOrCreateTicketService";
import verifyBusinessHours from "../WbotServices/helpers/VerifyBusinessHours";
import ShowWhatsAppService from "../WhatsappService/ShowWhatsAppService";
import InstagramVerifyContact from "./InstagramVerifyContact";
import VerifyMediaMessage from "./InstagramVerifyMediaMessage";
Expand All @@ -22,7 +23,6 @@ const handleRealtimeReceive = async (
ctx: MessageSyncMessageWrapper | any,
instaBot: Session
) => {
console.log(ctx);
const channel = await ShowWhatsAppService({ id: instaBot.id });
const threadData = await instaBot.feed
.directThread({ thread_id: ctx.message.thread_id, oldest_cursor: "" })
Expand Down Expand Up @@ -64,13 +64,13 @@ const handleRealtimeReceive = async (
ticket
);

// await verifyBusinessHours(
// {
// fromMe,
// timestamp: message.date
// },
// ticket
// );
await verifyBusinessHours(
{
fromMe,
timestamp: ctx.message.timestamp / 1000 // adequar horário node
},
ticket
);
};

export default handleRealtimeReceive;
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import MessengerVerifyMediaMessage from "./MessengerVerifyMediaMessage";
import VerifyStepsChatFlowTicket from "../ChatFlowServices/VerifyStepsChatFlowTicket";
import MessengerMarkRead from "./MessengerMarkRead";
import MessengerShowChannel from "./MessengerShowChannel";
import verifyBusinessHours from "../WbotServices/helpers/VerifyBusinessHours";

// eslint-disable-next-line consistent-return
const getMessageType = (message: any) => {
Expand Down Expand Up @@ -81,7 +82,7 @@ const MessengerHandleMessage = async (
}
await VerifyStepsChatFlowTicket(msgData, ticket);

// await verifyBusinessHours(msgData, ticket);
await verifyBusinessHours(msgData, ticket);
resolve();
} catch (error) {
logger.error(error);
Expand Down
2 changes: 1 addition & 1 deletion backend/src/services/TbotServices/HandleMessageTelegram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const HandleMessage = async (ctx: Context, tbot: Session): Promise<void> => {
const messageData = {
...message,
// compatibilizar timestamp com js
timestamp: +message.timestamp * 1000
timestamp: +message.date * 1000
};

const contact = await VerifyContact(ctx, channel.tenantId);
Expand Down
1 change: 0 additions & 1 deletion backend/src/services/TbotServices/tbotMessageListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const tbotMessageListener = (tbot: Session): void => {
});

tbot.on("edited_message", async ctx => {
console.log("edited_message", ctx);
HandleMessageTelegram(ctx, tbot);

// HandleMessageTelegram(ctx, tbot);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const StartAllWhatsAppsSessions = async (): Promise<void> => {
type: "whatsapp"
},
status: {
[Op.notIn]: ["DESTROYED", "qrcode"]
[Op.notIn]: ["DISCONNECTED", "qrcode"]
// "DISCONNECTED"
}
}
Expand Down
4 changes: 2 additions & 2 deletions backend/src/services/WbotServices/helpers/HandleMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import IsValidMsg from "./IsValidMsg";
import VerifyContact from "./VerifyContact";
import VerifyMediaMessage from "./VerifyMediaMessage";
import VerifyMessage from "./VerifyMessage";
// import verifyBusinessHours from "./VerifyBusinessHours";
import verifyBusinessHours from "./VerifyBusinessHours";
import VerifyStepsChatFlowTicket from "../../ChatFlowServices/VerifyStepsChatFlowTicket";
import Queue from "../../../libs/Queue";
// import isMessageExistsService from "../../MessageServices/isMessageExistsService";
Expand Down Expand Up @@ -118,7 +118,7 @@ const HandleMessage = async (
});
}

// await verifyBusinessHours(msg, ticket);
await verifyBusinessHours(msg, ticket);
resolve();
} catch (err) {
logger.error(err);
Expand Down

0 comments on commit f5500d4

Please sign in to comment.