Files
Checkmate/Server/routes/checkRoute.js
T

46 lines
1.1 KiB
JavaScript
Raw Normal View History

2024-10-15 11:57:37 +08:00
import { Router } from "express";
import { verifyOwnership } from "../middleware/verifyOwnership.js";
import { isAllowed } from "../middleware/isAllowed.js";
import Monitor from "../db/models/Monitor.js";
2024-12-24 11:58:56 -08:00
class CheckRoutes {
constructor(checkController) {
this.router = Router();
this.checkController = checkController;
this.initRoutes();
}
2024-05-27 13:51:51 -07:00
2024-12-24 11:58:56 -08:00
initRoutes() {
this.router.get("/:monitorId", this.checkController.getChecksByMonitor);
2024-12-24 11:58:56 -08:00
this.router.post(
"/:monitorId",
verifyOwnership(Monitor, "monitorId"),
this.checkController.createCheck
);
this.router.delete(
"/:monitorId",
verifyOwnership(Monitor, "monitorId"),
this.checkController.deleteChecks
);
2024-05-27 13:51:51 -07:00
this.router.get("/team/:teamId", this.checkController.getChecksByTeam);
2024-09-25 11:29:20 +08:00
2024-12-24 11:58:56 -08:00
this.router.delete(
"/team/:teamId",
isAllowed(["admin", "superadmin"]),
this.checkController.deleteChecksByTeamId
);
2024-08-30 09:43:16 -07:00
2024-12-24 11:58:56 -08:00
this.router.put(
"/team/ttl",
isAllowed(["admin", "superadmin"]),
this.checkController.updateChecksTTL
);
}
2024-09-12 12:49:18 +08:00
2024-12-24 11:58:56 -08:00
getRouter() {
return this.router;
}
}
export default CheckRoutes;