Add route, controller, and DB methods for fetching maintenance window by ID

This commit is contained in:
Alex Holliday committed 2024-10-09 12:06:01 +08:00
1 parent 114cfd6cb7
commit e3c0944062
10 files changed
+143 -16

No files matched your search

@@ -45,6 +45,19 @@ const createMaintenanceWindow = async (maintenanceWindowData) => {
}
};
const getMaintenanceWindowById = async (maintenanceWindowId) => {
try {
const maintenanceWindow = await MaintenanceWindow.findById({
_id: maintenanceWindowId,
});
return maintenanceWindow;
} catch (error) {
error.service = SERVICE_NAME;
error.method = "getMaintenanceWindowById";
throw error;
}
};
/**
* Asynchronously retrieves all MaintenanceWindow documents associated with a specific team ID.
* @async
@@ -202,6 +215,7 @@ const editMaintenanceWindowById = async (
module.exports = {
createMaintenanceWindow,
getMaintenanceWindowById,
getMaintenanceWindowsByTeamId,
getMaintenanceWindowsByMonitorId,
deleteMaintenanceWindowById,