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