From 66cde84ea6bb81a500b5238d7c9d6c13f8db38bd Mon Sep 17 00:00:00 2001 From: Rupam Kairi Date: Mon, 23 Dec 2024 17:05:50 +0530 Subject: [PATCH] Disabled Sending notifications on sms & whatsapp Added Filter for the alertMethod on "sms" & "whatsapp" values. A typo fix --- .../src/Services/Notifications/SendNotifications.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/server/src/Services/Notifications/SendNotifications.ts b/apps/server/src/Services/Notifications/SendNotifications.ts index b23b3d53..6ddf7b52 100644 --- a/apps/server/src/Services/Notifications/SendNotifications.ts +++ b/apps/server/src/Services/Notifications/SendNotifications.ts @@ -19,6 +19,7 @@ const sendNotifications = async (): Promise => { where: { isDelivered: false, sentAt: null, + alertMethod: {notIn: ['sms', 'whatsapp']} }, include: { siteAlert: { @@ -79,18 +80,18 @@ const sendNotifications = async (): Promise => { const siteName = site.name ? site.name : ''; const distanceKm = Math.round(distance / 1000); - let inout = `${distanceKm} km outside`; + let input = `${distanceKm} km outside`; if (distance == 0) { - inout = `inside`; + input = `inside`; } const checkLatLong = `Check ${latitude}, ${longitude} for fires.`; - const subject = `Likely fire ${inout} ${siteName} 🔥`; + const subject = `Likely fire ${input} ${siteName} 🔥`; - let message = `Detected ${inout} ${siteName} with ${confidence} confidence. ${checkLatLong}`; + let message = `Detected ${input} ${siteName} with ${confidence} confidence. ${checkLatLong}`; if (distance == 0) { - message = `Detected ${inout} ${siteName} with ${confidence} confidence. ${checkLatLong}`; + message = `Detected ${input} ${siteName} with ${confidence} confidence. ${checkLatLong}`; } const url = `https://firealert.plant-for-the-planet.org/alert/${alertId}`; @@ -114,7 +115,7 @@ const sendNotifications = async (): Promise => { timeZone: localTimeObject.timeZone, }); - message = `

A likely fire was detected at ${localEventDate} ${inout} ${siteName} with ${confidence} confidence

+ message = `

A likely fire was detected at ${localEventDate} ${input} ${siteName} with ${confidence} confidence

${checkLatLong}