modifications

This commit is contained in:
MuhammadKhalilzadeh committed 2024-06-29 11:58:27 +03:30
1 parent 704980045d
commit 81cd302acc
3 files changed
+38 -17

No files matched your search

+8 -1
View File
@@ -396,7 +396,7 @@ const getChecks = async (monitorId) => {
const deleteChecks = async (monitorId) => {
try {
const result = await Check.deleteMany({ monitorId });
return result;
return result.deletedCount;
} catch (error) {
throw error;
}
@@ -519,6 +519,13 @@ const deleteAlert = async (alertId) => {
}
};
/**
* Deletes alerts by monitor ID.
*
* @param {string} monitorId - The ID of the monitor.
* @returns {Promise} A promise that resolves to the result of the delete operation.
* @throws {Error} If an error occurs while deleting the alerts.
*/
const deleteAlertByMonitorId = async (monitorId) => {
try {
const result = await Alert.deleteMany({ monitorId });