@openinc/parse-server-opendash 3.14.7 → 3.14.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -22,13 +22,18 @@ async function init() {
|
|
|
22
22
|
});
|
|
23
23
|
(0, __1.beforeDeleteHook)(types_1.Maintenance_Schedule_Template, async (request) => {
|
|
24
24
|
const { object, original, user } = request;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
try {
|
|
26
|
+
//Check if a prenotification is scheduled
|
|
27
|
+
const notifyBeforeDue = object.get("notifyBeforeDue");
|
|
28
|
+
// If the notifyBeforeDue field is set, we will schedule a job to run before the due date
|
|
29
|
+
if (notifyBeforeDue && notifyBeforeDue.value > 0) {
|
|
30
|
+
await cron_1.default.removeJob(cron_1.default.constructJobName(object.id, "Maintenance_Schedule_Notification_Before_Due"));
|
|
31
|
+
}
|
|
32
|
+
await cron_1.default.removeJob(cron_1.default.constructJobName(object.id, "Maintenance_Schedule"));
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
console.error("Error removing jobs:", error);
|
|
30
36
|
}
|
|
31
|
-
await cron_1.default.removeJob(cron_1.default.constructJobName(object.id, "Maintenance_Schedule"));
|
|
32
37
|
});
|
|
33
38
|
(0, __1.afterDeleteHook)(types_1.Maintenance_Schedule_Template, async (request) => { });
|
|
34
39
|
}
|