diff --git a/server/src/controllers/statusPageController.ts b/server/src/controllers/statusPageController.ts index 8593cd53f..0c73b6e3b 100644 --- a/server/src/controllers/statusPageController.ts +++ b/server/src/controllers/statusPageController.ts @@ -15,7 +15,16 @@ import { NormalizeData } from "@/utils/dataUtils.js"; const SERVICE_NAME = "statusPageController"; -class StatusPageController { +export interface IStatusPageController { + readonly serviceName: string; + createStatusPage(req: Request, res: Response, next: NextFunction): Promise; + updateStatusPage(req: Request, res: Response, next: NextFunction): Promise; + getStatusPageByUrl(req: Request, res: Response, next: NextFunction): Promise; + getStatusPagesByTeamId(req: Request, res: Response, next: NextFunction): Promise; + deleteStatusPage(req: Request, res: Response, next: NextFunction): Promise; +} + +class StatusPageController implements IStatusPageController { static SERVICE_NAME = SERVICE_NAME; private statusPageService: IStatusPageService; private monitorsRepository: IMonitorsRepository; @@ -66,7 +75,7 @@ class StatusPageController { if (statusPage === null) { throw new AppError({ message: "Status page not found", status: 404 }); } - return res.status(200).json({ + res.status(200).json({ success: true, msg: "Status page updated successfully", data: statusPage, diff --git a/server/src/routes/statusPageRoute.ts b/server/src/routes/statusPageRoute.ts index a53aa04d9..871a67300 100755 --- a/server/src/routes/statusPageRoute.ts +++ b/server/src/routes/statusPageRoute.ts @@ -1,12 +1,13 @@ +import { IStatusPageController } from "@/controllers/statusPageController.js"; import { RequestHandler, Router } from "express"; import multer from "multer"; const upload = multer(); class StatusPageRoutes { private router: Router; - private statusPageController: any; + private statusPageController: IStatusPageController; - constructor(statusPageController: any, verifyJWT: RequestHandler, verifyStatusPageAccess: RequestHandler) { + constructor(statusPageController: IStatusPageController, verifyJWT: RequestHandler, verifyStatusPageAccess: RequestHandler) { this.router = Router(); this.statusPageController = statusPageController; this.initRoutes(verifyJWT, verifyStatusPageAccess);