2025-11-18 16:01:47 -05:00
|
|
|
import { Router } from "express";
|
2026-01-21 10:36:03 -08:00
|
|
|
import { isAllowed } from "../middleware/isAllowed.js";
|
2025-11-18 16:01:47 -05:00
|
|
|
|
|
|
|
|
class IncidentRoutes {
|
2026-01-21 10:36:03 -08:00
|
|
|
private router: Router;
|
|
|
|
|
private incidentController: any;
|
|
|
|
|
|
|
|
|
|
constructor(incidentController: any) {
|
2025-11-18 16:01:47 -05:00
|
|
|
this.router = Router();
|
|
|
|
|
this.incidentController = incidentController;
|
|
|
|
|
this.initRoutes();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
initRoutes() {
|
|
|
|
|
// Team routes
|
|
|
|
|
this.router.get("/team", this.incidentController.getIncidentsByTeam);
|
|
|
|
|
this.router.get("/team/summary", this.incidentController.getIncidentSummary);
|
|
|
|
|
|
|
|
|
|
// Individual incident routes
|
|
|
|
|
this.router.get("/:incidentId", this.incidentController.getIncidentById);
|
|
|
|
|
this.router.put("/:incidentId/resolve", isAllowed(["admin", "superadmin"]), this.incidentController.resolveIncidentManually);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getRouter() {
|
|
|
|
|
return this.router;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default IncidentRoutes;
|