From e8b1d29c43fc9da0e066ec7f5438cec039be872f Mon Sep 17 00:00:00 2001 From: harid Date: Mon, 1 Dec 2025 14:56:31 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B8=AD=E0=B8=AD?= =?UTF-8?q?=E0=B8=81=E0=B8=84=E0=B8=B3=E0=B8=AA=E0=B8=B1=E0=B9=88=E0=B8=87?= =?UTF-8?q?=E0=B9=81=E0=B8=95=E0=B9=88=E0=B8=87=E0=B8=95=E0=B8=B1=E0=B9=89?= =?UTF-8?q?=E0=B8=87=E0=B8=84=E0=B8=93=E0=B8=B0=E0=B8=81=E0=B8=A3=E0=B8=A3?= =?UTF-8?q?=E0=B8=A1=20Noti=20=E0=B8=8B=E0=B9=89=E0=B8=B3=20=20#1995?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/rabbitmq.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/services/rabbitmq.ts b/src/services/rabbitmq.ts index 0c18117c..844b4587 100644 --- a/src/services/rabbitmq.ts +++ b/src/services/rabbitmq.ts @@ -402,7 +402,9 @@ async function handler_command_noti(msg: amqp.ConsumeMessage): Promise const { profiles, command } = data; try { - const profilesNotiRequest = new CallAPI() + let profilesNotiRequest: Promise | undefined; + if (!(["C-PM-10"].includes(command.commandType.code))) { + profilesNotiRequest = new CallAPI() .PostData( { headers: { authorization: token } }, "/placement/noti/profiles", @@ -432,6 +434,7 @@ async function handler_command_noti(msg: amqp.ConsumeMessage): Promise } console.error("Full error object:", error); }); + } let profilesSend = command && command.commandSends.length > 0 @@ -475,13 +478,12 @@ async function handler_command_noti(msg: amqp.ConsumeMessage): Promise }); /*เฉพาะคำสั่ง C-PM-10 ให้ตัด profilesNotiRequest ที่ส่ง noti ครั้งแรกออก*/ - if (command && command.commandType && ["C-PM-10"].includes(command.commandType.code)) { + if (["C-PM-10"].includes(command.commandType.code)) { await Promise.all([profilesSendRequest]); } else { - await Promise.all([profilesNotiRequest, profilesSendRequest]); + await Promise.all([profilesNotiRequest!, profilesSendRequest]); } - console.log("[AMQ] Send Notification Success"); return true;