refactor(blocking notification): changed to look at the latest blocking order and only pull 1 at a t

This commit is contained in:
2025-05-02 07:51:46 -05:00
parent a709be838f
commit 981c04e741

View File

@@ -39,9 +39,16 @@ export default async function qualityBlockingMonitor(notifyData: any) {
}
);
// console.log(blockingOrders);
// let blockingQuery = blockQuery.replaceAll(
// "[sentBlockingOrders]",
// blockingOrders
// );
let blockingQuery = blockQuery.replaceAll(
"[sentBlockingOrders]",
blockingOrders
"[lastBlocking]",
notiData[0]?.notifiySettings.prodID
);
const { data: b, error: blockingError } = await tryCatch(
@@ -115,6 +122,12 @@ export default async function qualityBlockingMonitor(notifyData: any) {
.where(eq(notifications.name, notifyData.name))
);
if (error) {
createLog(
"error",
"blocking",
"notify",
"Error updating the blocking orders"
);
return {
success: false,
message: "Error updating the blocking orders",