Feat/maintenance window controller (#475)
* Added createMaintenanceWindow route * Added getMaintenanceWindowsByUserId * Added getMaintenaceWindowsByMonitorId method, updated routes * Exported delete methods
This commit is contained in:
1 parent
5fe92f2b31
commit
95dfc8d82c
7 files changed
+168
-2
No files matched your search
@@ -108,6 +108,18 @@ const {
|
||||
deleteAlertByMonitorId,
|
||||
} = require("./modules/alertModule");
|
||||
|
||||
//****************************************
|
||||
// Maintenance Window
|
||||
//****************************************
|
||||
const {
|
||||
createMaintenanceWindow,
|
||||
getMaintenanceWindowsByUserId,
|
||||
getMaintenanceWindowsByMonitorId,
|
||||
deleteMaintenaceWindowById,
|
||||
deleteMaintenanceWindowByMonitorId,
|
||||
deleteMaintenanceWindowByUserId,
|
||||
} = require("./modules/maintenaceWindowModule");
|
||||
|
||||
module.exports = {
|
||||
connect,
|
||||
insertUser,
|
||||
@@ -144,4 +156,10 @@ module.exports = {
|
||||
createPageSpeedCheck,
|
||||
getPageSpeedChecks,
|
||||
deletePageSpeedChecks,
|
||||
createMaintenanceWindow,
|
||||
getMaintenanceWindowsByUserId,
|
||||
getMaintenanceWindowsByMonitorId,
|
||||
deleteMaintenaceWindowById,
|
||||
deleteMaintenanceWindowByMonitorId,
|
||||
deleteMaintenanceWindowByUserId,
|
||||
};
|
||||
@@ -54,7 +54,7 @@ const createMaintenanceWindow = async (maintenanceWindowData) => {
|
||||
* .then(maintenanceWindows => console.log(maintenanceWindows))
|
||||
* .catch(error => console.error(error));
|
||||
*/
|
||||
const getMaintenanceWindowByUserId = async (userId) => {
|
||||
const getMaintenanceWindowsByUserId = async (userId) => {
|
||||
try {
|
||||
const maintenanceWindows = await MaintenanceWindow.find({ userId: userId });
|
||||
return maintenanceWindows;
|
||||
@@ -152,7 +152,7 @@ const deleteMaintenanceWindowByUserId = async (userId) => {
|
||||
|
||||
module.exports = {
|
||||
createMaintenanceWindow,
|
||||
getMaintenanceWindowByUserId,
|
||||
getMaintenanceWindowsByUserId,
|
||||
getMaintenanceWindowsByMonitorId,
|
||||
deleteMaintenaceWindowById,
|
||||
deleteMaintenanceWindowByMonitorId,
|
||||
|
||||
Reference in new issue
Block a user