Files
Checkmate/server/routes/checkRoute.js
T

57 lines
1.4 KiB
JavaScript
Raw Normal View History

2025-04-20 11:29:53 -07:00
import { Router } from "express";
import { verifyOwnership } from "../middleware/verifyOwnership.js";
2025-06-25 11:52:38 +05:30
import { verifyTeamAccess } from "../middleware/verifyTeamAccess.js";
2025-04-20 11:29:53 -07:00
import { isAllowed } from "../middleware/isAllowed.js";
import Monitor from "../db/models/Monitor.js";
2025-06-25 11:52:38 +05:30
import Check from "../db/models/Check.js";
2025-04-20 11:29:53 -07:00
class CheckRoutes {
constructor(checkController) {
this.router = Router();
this.checkController = checkController;
this.initRoutes();
}
initRoutes() {
2025-06-13 12:04:39 +08:00
this.router.get("/team", this.checkController.getChecksByTeam);
2025-07-01 18:10:35 +05:30
this.router.get("/team/summary", this.checkController.getChecksSummaryByTeamId);
2025-06-13 12:04:39 +08:00
this.router.delete(
"/team",
isAllowed(["admin", "superadmin"]),
this.checkController.deleteChecksByTeamId
);
2025-04-20 11:29:53 -07:00
this.router.get("/:monitorId", this.checkController.getChecksByMonitor);
2025-06-13 12:04:39 +08:00
2025-06-25 14:16:00 +05:30
this.router.put(
"/check/:checkId",
verifyTeamAccess(Check, "checkId"),
this.checkController.ackCheck
);
2025-06-20 15:39:13 +05:30
2025-06-24 14:44:02 +05:30
this.router.put("/:path/:monitorId?", this.checkController.ackAllChecks);
2025-06-20 16:11:22 +05:30
2025-04-20 11:29:53 -07:00
this.router.post(
"/:monitorId",
verifyOwnership(Monitor, "monitorId"),
this.checkController.createCheck
);
this.router.delete(
"/:monitorId",
verifyOwnership(Monitor, "monitorId"),
this.checkController.deleteChecks
);
this.router.put(
"/team/ttl",
isAllowed(["admin", "superadmin"]),
this.checkController.updateChecksTTL
);
}
getRouter() {
return this.router;
}
}
export default CheckRoutes;