Merge branch 'develop' into dev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 55s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 55s
This commit is contained in:
commit
950e5e4553
1 changed files with 6 additions and 4 deletions
|
|
@ -402,7 +402,9 @@ async function handler_command_noti(msg: amqp.ConsumeMessage): Promise<boolean>
|
||||||
const { profiles, command } = data;
|
const { profiles, command } = data;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const profilesNotiRequest = new CallAPI()
|
let profilesNotiRequest: Promise<any> | undefined;
|
||||||
|
if (!(["C-PM-10"].includes(command.commandType.code))) {
|
||||||
|
profilesNotiRequest = new CallAPI()
|
||||||
.PostData(
|
.PostData(
|
||||||
{ headers: { authorization: token } },
|
{ headers: { authorization: token } },
|
||||||
"/placement/noti/profiles",
|
"/placement/noti/profiles",
|
||||||
|
|
@ -432,6 +434,7 @@ async function handler_command_noti(msg: amqp.ConsumeMessage): Promise<boolean>
|
||||||
}
|
}
|
||||||
console.error("Full error object:", error);
|
console.error("Full error object:", error);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let profilesSend =
|
let profilesSend =
|
||||||
command && command.commandSends.length > 0
|
command && command.commandSends.length > 0
|
||||||
|
|
@ -475,13 +478,12 @@ async function handler_command_noti(msg: amqp.ConsumeMessage): Promise<boolean>
|
||||||
});
|
});
|
||||||
|
|
||||||
/*เฉพาะคำสั่ง C-PM-10 ให้ตัด profilesNotiRequest ที่ส่ง noti ครั้งแรกออก*/
|
/*เฉพาะคำสั่ง 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]);
|
await Promise.all([profilesSendRequest]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
await Promise.all([profilesNotiRequest, profilesSendRequest]);
|
await Promise.all([profilesNotiRequest!, profilesSendRequest]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
console.log("[AMQ] Send Notification Success");
|
console.log("[AMQ] Send Notification Success");
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue