mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-05-18 23:48:43 -05:00
+12
-13
@@ -1,23 +1,22 @@
|
||||
import { createVerifyJWT } from "../middleware/verifyJWT.js";
|
||||
import { authApiLimiter } from "../middleware/rateLimiter.js";
|
||||
|
||||
import AuthRoutes from "../routes/v1/authRoute.js";
|
||||
import InviteRoutes from "../routes/v1/inviteRoute.js";
|
||||
import MonitorRoutes from "../routes/v1/monitorRoute.js";
|
||||
import CheckRoutes from "../routes/v1/checkRoute.js";
|
||||
import SettingsRoutes from "../routes/v1/settingsRoute.js";
|
||||
import MaintenanceWindowRoutes from "../routes/v1/maintenanceWindowRoute.js";
|
||||
import StatusPageRoutes from "../routes/v1/statusPageRoute.js";
|
||||
import QueueRoutes from "../routes/v1/queueRoute.js";
|
||||
import LogRoutes from "../routes/v1/logRoutes.js";
|
||||
import DiagnosticRoutes from "../routes/v1/diagnosticRoute.js";
|
||||
import NotificationRoutes from "../routes/v1/notificationRoute.js";
|
||||
import AuthRoutes from "../routes/authRoute.js";
|
||||
import InviteRoutes from "../routes/inviteRoute.js";
|
||||
import MonitorRoutes from "../routes/monitorRoute.js";
|
||||
import CheckRoutes from "../routes/checkRoute.js";
|
||||
import SettingsRoutes from "../routes/settingsRoute.js";
|
||||
import MaintenanceWindowRoutes from "../routes/maintenanceWindowRoute.js";
|
||||
import StatusPageRoutes from "../routes/statusPageRoute.js";
|
||||
import QueueRoutes from "../routes/queueRoute.js";
|
||||
import LogRoutes from "../routes/logRoutes.js";
|
||||
import DiagnosticRoutes from "../routes/diagnosticRoute.js";
|
||||
import NotificationRoutes from "../routes/notificationRoute.js";
|
||||
|
||||
import IncidentRoutes from "../routes/v1/incidentRoute.js";
|
||||
import IncidentRoutes from "../routes/incidentRoute.js";
|
||||
|
||||
export const setupRoutes = (app: any, controllers: Record<string, any>, services: Record<string, any>) => {
|
||||
const verifyJWT = createVerifyJWT(services.settingsService);
|
||||
// V1
|
||||
const authRoutes = new AuthRoutes(controllers.authController, verifyJWT);
|
||||
const monitorRoutes = new MonitorRoutes(controllers.monitorController);
|
||||
const settingsRoutes = new SettingsRoutes(controllers.settingsController);
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
import { Router } from "express";
|
||||
import { isAllowed } from "../../middleware/isAllowed.js";
|
||||
import { Router, RequestHandler } from "express";
|
||||
import { isAllowed } from "../middleware/isAllowed.js";
|
||||
import multer from "multer";
|
||||
|
||||
const upload = multer();
|
||||
|
||||
class AuthRoutes {
|
||||
constructor(authController, verifyJWT) {
|
||||
private router: Router;
|
||||
private authController: any;
|
||||
|
||||
constructor(authController: any, verifyJWT: RequestHandler) {
|
||||
this.router = Router();
|
||||
this.authController = authController;
|
||||
this.initRoutes(verifyJWT);
|
||||
}
|
||||
|
||||
initRoutes(verifyJWT) {
|
||||
initRoutes(verifyJWT: RequestHandler) {
|
||||
this.router.post("/register", upload.single("profileImage"), this.authController.registerUser);
|
||||
this.router.post("/login", this.authController.loginUser);
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import { Router } from "express";
|
||||
|
||||
import { isAllowed } from "../../middleware/isAllowed.js";
|
||||
import { isAllowed } from "../middleware/isAllowed.js";
|
||||
|
||||
class CheckRoutes {
|
||||
constructor(checkController) {
|
||||
private router: Router;
|
||||
private checkController: any;
|
||||
|
||||
constructor(checkController: any) {
|
||||
this.router = Router();
|
||||
this.checkController = checkController;
|
||||
this.initRoutes();
|
||||
@@ -1,14 +1,17 @@
|
||||
import { Router } from "express";
|
||||
import { isAllowed } from "../../middleware/isAllowed.js";
|
||||
import { RequestHandler, Router } from "express";
|
||||
import { isAllowed } from "../middleware/isAllowed.js";
|
||||
|
||||
class DiagnosticRoutes {
|
||||
constructor(diagnosticController, verifyJWT) {
|
||||
private router: Router;
|
||||
private diagnosticController: any;
|
||||
|
||||
constructor(diagnosticController: any, verifyJWT: RequestHandler) {
|
||||
this.router = Router();
|
||||
this.diagnosticController = diagnosticController;
|
||||
this.initRoutes(verifyJWT);
|
||||
}
|
||||
|
||||
initRoutes(verifyJWT) {
|
||||
initRoutes(verifyJWT: RequestHandler) {
|
||||
this.router.get("/system", verifyJWT, isAllowed(["admin", "superadmin"]), this.diagnosticController.getSystemStats);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import { Router } from "express";
|
||||
import { isAllowed } from "../../middleware/isAllowed.js";
|
||||
import { isAllowed } from "../middleware/isAllowed.js";
|
||||
|
||||
class IncidentRoutes {
|
||||
constructor(incidentController) {
|
||||
private router: Router;
|
||||
private incidentController: any;
|
||||
|
||||
constructor(incidentController: any) {
|
||||
this.router = Router();
|
||||
this.incidentController = incidentController;
|
||||
this.initRoutes();
|
||||
@@ -1,14 +1,17 @@
|
||||
import { Router } from "express";
|
||||
import { isAllowed } from "../../middleware/isAllowed.js";
|
||||
import { RequestHandler, Router } from "express";
|
||||
import { isAllowed } from "../middleware/isAllowed.js";
|
||||
|
||||
class InviteRoutes {
|
||||
constructor(inviteController, verifyJWT) {
|
||||
private router: Router;
|
||||
private inviteController: any;
|
||||
|
||||
constructor(inviteController: any, verifyJWT: RequestHandler) {
|
||||
this.router = Router();
|
||||
this.inviteController = inviteController;
|
||||
this.initRoutes(verifyJWT);
|
||||
}
|
||||
|
||||
initRoutes(verifyJWT) {
|
||||
initRoutes(verifyJWT: RequestHandler) {
|
||||
this.router.post("/send", verifyJWT, isAllowed(["admin", "superadmin"]), this.inviteController.sendInviteEmail);
|
||||
this.router.post("/verify", this.inviteController.verifyInviteToken);
|
||||
this.router.post("/", verifyJWT, isAllowed(["admin", "superadmin"]), this.inviteController.getInviteToken);
|
||||
@@ -1,7 +1,10 @@
|
||||
import { Router } from "express";
|
||||
import { isAllowed } from "../../middleware/isAllowed.js";
|
||||
import { isAllowed } from "../middleware/isAllowed.js";
|
||||
class LogRoutes {
|
||||
constructor(logController) {
|
||||
private router: Router;
|
||||
private logController: any;
|
||||
|
||||
constructor(logController: any) {
|
||||
this.router = Router();
|
||||
this.logController = logController;
|
||||
this.initRoutes();
|
||||
+4
-1
@@ -1,7 +1,10 @@
|
||||
import { Router } from "express";
|
||||
|
||||
class MaintenanceWindowRoutes {
|
||||
constructor(maintenanceWindowController) {
|
||||
private router: Router;
|
||||
private mwController: any;
|
||||
|
||||
constructor(maintenanceWindowController: any) {
|
||||
this.router = Router();
|
||||
this.mwController = maintenanceWindowController;
|
||||
this.initRoutes();
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Router } from "express";
|
||||
import { isAllowed } from "../../middleware/isAllowed.js";
|
||||
import { isAllowed } from "@/middleware/isAllowed.js";
|
||||
import multer from "multer";
|
||||
import { fetchMonitorCertificate } from "../../controllers/controllerUtils.js";
|
||||
import { fetchMonitorCertificate } from "@/controllers/controllerUtils.js";
|
||||
const upload = multer({
|
||||
storage: multer.memoryStorage(), // Store file in memory as Buffer
|
||||
});
|
||||
@@ -1,6 +1,9 @@
|
||||
import { Router } from "express";
|
||||
class NotificationRoutes {
|
||||
constructor(notificationController) {
|
||||
private router: Router;
|
||||
private notificationController: any;
|
||||
|
||||
constructor(notificationController: any) {
|
||||
this.router = Router();
|
||||
this.notificationController = notificationController;
|
||||
this.initializeRoutes();
|
||||
@@ -1,7 +1,10 @@
|
||||
import { Router } from "express";
|
||||
import { isAllowed } from "../../middleware/isAllowed.js";
|
||||
import { isAllowed } from "../middleware/isAllowed.js";
|
||||
class QueueRoutes {
|
||||
constructor(queueController) {
|
||||
private router: Router;
|
||||
private queueController: any;
|
||||
|
||||
constructor(queueController: any) {
|
||||
this.router = Router();
|
||||
this.queueController = queueController;
|
||||
this.initRoutes();
|
||||
@@ -1,8 +1,11 @@
|
||||
import { Router } from "express";
|
||||
import { isAllowed } from "../../middleware/isAllowed.js";
|
||||
import { isAllowed } from "../middleware/isAllowed.js";
|
||||
|
||||
class SettingsRoutes {
|
||||
constructor(settingsController) {
|
||||
private router: Router;
|
||||
private settingsController: any;
|
||||
|
||||
constructor(settingsController: any) {
|
||||
this.router = Router();
|
||||
this.settingsController = settingsController;
|
||||
this.initRoutes();
|
||||
@@ -1,15 +1,18 @@
|
||||
import { Router } from "express";
|
||||
import { RequestHandler, Router } from "express";
|
||||
import multer from "multer";
|
||||
const upload = multer();
|
||||
|
||||
class StatusPageRoutes {
|
||||
constructor(statusPageController, verifyJWT) {
|
||||
private router: Router;
|
||||
private statusPageController: any;
|
||||
|
||||
constructor(statusPageController: any, verifyJWT: RequestHandler) {
|
||||
this.router = Router();
|
||||
this.statusPageController = statusPageController;
|
||||
this.initRoutes(verifyJWT);
|
||||
}
|
||||
|
||||
initRoutes(verifyJWT) {
|
||||
initRoutes(verifyJWT: RequestHandler) {
|
||||
this.router.get("/", this.statusPageController.getStatusPage);
|
||||
this.router.get("/team", verifyJWT, this.statusPageController.getStatusPagesByTeamId);
|
||||
|
||||
Reference in New Issue
Block a user