2024-10-15 11:57:37 +08:00
|
|
|
import { Router } from "express";
|
|
|
|
|
import { verifyOwnership } from "../middleware/verifyOwnership.js";
|
|
|
|
|
import Monitor from "../db/models/Monitor.js";
|
|
|
|
|
|
2024-12-24 11:58:56 -08:00
|
|
|
class MaintenanceWindowRoutes {
|
|
|
|
|
constructor(maintenanceWindowController) {
|
|
|
|
|
this.router = Router();
|
|
|
|
|
this.maintenanceWindowController = maintenanceWindowController;
|
|
|
|
|
this.initRoutes();
|
|
|
|
|
}
|
|
|
|
|
initRoutes() {
|
|
|
|
|
this.router.post("/", this.maintenanceWindowController.createMaintenanceWindows);
|
2024-07-30 10:01:52 -07:00
|
|
|
|
2024-12-24 11:58:56 -08:00
|
|
|
this.router.get(
|
|
|
|
|
"/monitor/:monitorId",
|
|
|
|
|
verifyOwnership(Monitor, "monitorId"),
|
|
|
|
|
this.maintenanceWindowController.getMaintenanceWindowsByMonitorId
|
|
|
|
|
);
|
2024-10-04 12:24:40 +08:00
|
|
|
|
2024-12-24 11:58:56 -08:00
|
|
|
this.router.get(
|
|
|
|
|
"/team/",
|
|
|
|
|
this.maintenanceWindowController.getMaintenanceWindowsByTeamId
|
|
|
|
|
);
|
2024-09-25 12:11:18 +08:00
|
|
|
|
2024-12-24 11:58:56 -08:00
|
|
|
this.router.get("/:id", this.maintenanceWindowController.getMaintenanceWindowById);
|
2024-07-30 10:01:52 -07:00
|
|
|
|
2024-12-24 11:58:56 -08:00
|
|
|
this.router.put("/:id", this.maintenanceWindowController.editMaintenanceWindow);
|
2024-10-09 12:06:01 +08:00
|
|
|
|
2024-12-24 11:58:56 -08:00
|
|
|
this.router.delete("/:id", this.maintenanceWindowController.deleteMaintenanceWindow);
|
|
|
|
|
}
|
2024-10-09 11:33:12 +08:00
|
|
|
|
2024-12-24 11:58:56 -08:00
|
|
|
getRouter() {
|
|
|
|
|
return this.router;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-09 11:07:14 +08:00
|
|
|
|
2024-12-24 11:58:56 -08:00
|
|
|
export default MaintenanceWindowRoutes;
|