remove check ack routes and controller functions
This commit is contained in:
1 parent
36b02e5e66
commit
476ff39a17
2 files changed
-52
No files matched your search
@@ -77,53 +77,6 @@ class CheckController {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ackCheck = async (req: Request, res: Response, next: NextFunction) => {
|
|
||||||
try {
|
|
||||||
await ackCheckBodyValidation.validateAsync(req.body);
|
|
||||||
|
|
||||||
const updatedCheck = await this.checkService.ackCheck({
|
|
||||||
checkId: req?.params?.checkId,
|
|
||||||
teamId: req?.user?.teamId,
|
|
||||||
ack: req?.body?.ack,
|
|
||||||
});
|
|
||||||
|
|
||||||
return res.status(200).json({
|
|
||||||
success: true,
|
|
||||||
msg: "Check acknowledged successfully",
|
|
||||||
data: updatedCheck,
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
next(error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ackAllChecks = async (req: Request, res: Response, next: NextFunction) => {
|
|
||||||
try {
|
|
||||||
await ackAllChecksParamValidation.validateAsync(req.params);
|
|
||||||
await ackAllChecksBodyValidation.validateAsync(req.body);
|
|
||||||
|
|
||||||
const teamId = req?.user?.teamId;
|
|
||||||
if (!teamId) {
|
|
||||||
throw new Error("No team ID in request");
|
|
||||||
}
|
|
||||||
|
|
||||||
const updatedChecks = await this.checkService.ackAllChecks({
|
|
||||||
monitorId: req?.params?.monitorId,
|
|
||||||
path: req?.params?.path,
|
|
||||||
teamId: req?.user?.teamId,
|
|
||||||
ack: req?.body?.ack,
|
|
||||||
});
|
|
||||||
|
|
||||||
return res.status(200).json({
|
|
||||||
success: true,
|
|
||||||
msg: "All checks acknowledged successfully",
|
|
||||||
data: updatedChecks,
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
next(error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
deleteChecks = async (req: Request, res: Response, next: NextFunction) => {
|
deleteChecks = async (req: Request, res: Response, next: NextFunction) => {
|
||||||
try {
|
try {
|
||||||
await deleteChecksParamValidation.validateAsync(req.params);
|
await deleteChecksParamValidation.validateAsync(req.params);
|
||||||
|
|||||||
@@ -14,13 +14,8 @@ class CheckRoutes {
|
|||||||
this.router.get("/team", this.checkController.getChecksByTeam);
|
this.router.get("/team", this.checkController.getChecksByTeam);
|
||||||
this.router.put("/team/ttl", isAllowed(["admin", "superadmin"]), this.checkController.updateChecksTTL);
|
this.router.put("/team/ttl", isAllowed(["admin", "superadmin"]), this.checkController.updateChecksTTL);
|
||||||
this.router.delete("/team", isAllowed(["admin", "superadmin"]), this.checkController.deleteChecksByTeamId);
|
this.router.delete("/team", isAllowed(["admin", "superadmin"]), this.checkController.deleteChecksByTeamId);
|
||||||
|
|
||||||
this.router.put("/check/:checkId", this.checkController.ackCheck);
|
|
||||||
|
|
||||||
this.router.get("/:monitorId", this.checkController.getChecksByMonitor);
|
this.router.get("/:monitorId", this.checkController.getChecksByMonitor);
|
||||||
this.router.delete("/:monitorId", this.checkController.deleteChecks);
|
this.router.delete("/:monitorId", this.checkController.deleteChecks);
|
||||||
|
|
||||||
this.router.put("/:path/:monitorId?", this.checkController.ackAllChecks);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getRouter() {
|
getRouter() {
|
||||||
|
|||||||
Reference in new issue
Block a user