revert another unintentional change

This commit is contained in:
Frank Elsinga 2025-04-26 22:50:43 +02:00
parent a4ef1471b7
commit 5b54641730

View file

@ -75,6 +75,7 @@ const YZJ = require("./notification-providers/yzj");
const SMSPlanet = require("./notification-providers/sms-planet");
class Notification {
providerList = {};
/**
@ -184,19 +185,9 @@ class Notification {
* @returns {Promise<string>} Successful msg
* @throws Error with fail msg
*/
static async send(
notification,
msg,
monitorJSON = null,
heartbeatJSON = null
) {
static async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
if (this.providerList[notification.type]) {
return this.providerList[notification.type].send(
notification,
msg,
monitorJSON,
heartbeatJSON
);
return this.providerList[notification.type].send(notification, msg, monitorJSON, heartbeatJSON);
} else {
throw new Error("Notification type is not supported");
}
@ -221,6 +212,7 @@ class Notification {
if (! bean) {
throw new Error("notification not found");
}
} else {
bean = R.dispense("notification");
}
@ -266,6 +258,7 @@ class Notification {
let exists = commandExistsSync("apprise");
return exists;
}
}
/**
@ -276,15 +269,14 @@ class Notification {
*/
async function applyNotificationEveryMonitor(notificationID, userID) {
let monitors = await R.getAll("SELECT id FROM monitor WHERE user_id = ?", [
userID,
userID
]);
for (let i = 0; i < monitors.length; i++) {
let checkNotification = await R.findOne(
"monitor_notification",
" monitor_id = ? AND notification_id = ? ",
[ monitors[i].id, notificationID ]
);
let checkNotification = await R.findOne("monitor_notification", " monitor_id = ? AND notification_id = ? ", [
monitors[i].id,
notificationID,
]);
if (! checkNotification) {
let relation = R.dispense("monitor_notification");