From 1706012e54e2f8c05eef55dca3c7086379f3e651 Mon Sep 17 00:00:00 2001 From: ashu130698 Date: Fri, 13 Mar 2026 21:40:28 +0530 Subject: [PATCH] fix:format code --- server/src/controllers/monitorController.ts | 10 +++++----- .../src/controllers/notificationController.ts | 1 - server/src/routes/notificationRoute.ts | 1 - server/src/service/business/monitorService.ts | 18 ++++++++++++++---- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/server/src/controllers/monitorController.ts b/server/src/controllers/monitorController.ts index a1d5fb242..4dc28d60d 100644 --- a/server/src/controllers/monitorController.ts +++ b/server/src/controllers/monitorController.ts @@ -410,12 +410,12 @@ class MonitorController { // Verify all requested notification IDs actually belong to this team const teamNotifications = await this.notificationsService.findNotificationsByTeamId(teamId); const validNotificationIds = teamNotifications.map((n) => n.id); - + const invalidIds = notificationIds.filter((id: string) => !validNotificationIds.includes(id)); if (invalidIds.length > 0) { - throw new AppError({ - message: `The following notification IDs are invalid or do not belong to your team: ${invalidIds.join(", ")}`, - status: 403 + throw new AppError({ + message: `The following notification IDs are invalid or do not belong to your team: ${invalidIds.join(", ")}`, + status: 403, }); } @@ -423,7 +423,7 @@ class MonitorController { teamId, monitorIds, notificationIds, - action + action, }); return res.status(200).json({ diff --git a/server/src/controllers/notificationController.ts b/server/src/controllers/notificationController.ts index f6b53f8d3..577823c12 100644 --- a/server/src/controllers/notificationController.ts +++ b/server/src/controllers/notificationController.ts @@ -126,7 +126,6 @@ class NotificationController { } }; - testAllNotifications = async (req: Request, res: Response, next: NextFunction) => { try { const validatedBody = testAllNotificationsBodyValidation.parse(req.body); diff --git a/server/src/routes/notificationRoute.ts b/server/src/routes/notificationRoute.ts index 43d9963a1..a1802d3b9 100755 --- a/server/src/routes/notificationRoute.ts +++ b/server/src/routes/notificationRoute.ts @@ -17,7 +17,6 @@ class NotificationRoutes { this.router.get("/team", this.notificationController.getNotificationsByTeamId); - this.router.get("/:id", this.notificationController.getNotificationById); this.router.delete("/:id", this.notificationController.deleteNotification); this.router.patch("/:id", this.notificationController.editNotification); diff --git a/server/src/service/business/monitorService.ts b/server/src/service/business/monitorService.ts index 9561b7d32..6e0446645 100644 --- a/server/src/service/business/monitorService.ts +++ b/server/src/service/business/monitorService.ts @@ -438,15 +438,25 @@ export class MonitorService implements IMonitorService { return editedMonitor; }; - updateNotifications = async ({ teamId, monitorIds, notificationIds, action }: { teamId: string; monitorIds: string[]; notificationIds: string[]; action: "add" | "remove" | "set" }): Promise => { + updateNotifications = async ({ + teamId, + monitorIds, + notificationIds, + action, + }: { + teamId: string; + monitorIds: string[]; + notificationIds: string[]; + action: "add" | "remove" | "set"; + }): Promise => { const modifiedCount = await this.monitorsRepository.updateNotifications(monitorIds, notificationIds, action, teamId); - + // If notifications were updated, we should update the jobs in the queue if (modifiedCount > 0) { const monitors = await this.monitorsRepository.findByIds(monitorIds); - await Promise.all(monitors.map(monitor => this.jobQueue.updateJob(monitor))); + await Promise.all(monitors.map((monitor) => this.jobQueue.updateJob(monitor))); } - + return modifiedCount; };