26 lines
754 B
JavaScript
26 lines
754 B
JavaScript
import { Router } from "express";
|
|||
|
|
import { isAllowed } from "../../middleware/v1/isAllowed.js";
|
||
|
|
|
||
|
|
class IncidentRoutes {
|
||
|
|
constructor(incidentController) {
|
||
|
|
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;
|