5 files changed
+18
-11
No files matched your search
@@ -197,7 +197,7 @@ class AuthController {
|
|||||||
throw new AppError({ message: "Unauthorized", status: 403 });
|
throw new AppError({ message: "Unauthorized", status: 403 });
|
||||||
}
|
}
|
||||||
|
|
||||||
const userId = req.params.userId;
|
const userId = req.params.userId as string;
|
||||||
const user = { ...req.body };
|
const user = { ...req.body };
|
||||||
|
|
||||||
await editUserByIdParamValidation.validateAsync(req.params);
|
await editUserByIdParamValidation.validateAsync(req.params);
|
||||||
@@ -222,7 +222,7 @@ class AuthController {
|
|||||||
throw new AppError({ message: "Unauthorized", status: 403 });
|
throw new AppError({ message: "Unauthorized", status: 403 });
|
||||||
}
|
}
|
||||||
|
|
||||||
const userId = req.params.userId;
|
const userId = req.params.userId as string;
|
||||||
await editUserByIdParamValidation.validateAsync(req.params);
|
await editUserByIdParamValidation.validateAsync(req.params);
|
||||||
await editUserPasswordByIdBodyValidation.validateAsync(req.body);
|
await editUserPasswordByIdBodyValidation.validateAsync(req.body);
|
||||||
const updatedPassword = req.body.password;
|
const updatedPassword = req.body.password;
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ class CheckController {
|
|||||||
await deleteChecksParamValidation.validateAsync(req.params);
|
await deleteChecksParamValidation.validateAsync(req.params);
|
||||||
|
|
||||||
const deletedCount = await this.checkService.deleteChecks({
|
const deletedCount = await this.checkService.deleteChecks({
|
||||||
monitorId: req.params.monitorId,
|
monitorId: req.params.monitorId as string,
|
||||||
teamId: req?.user?.teamId,
|
teamId: req?.user?.teamId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class IncidentController {
|
|||||||
getIncidentById = async (req: Request, res: Response, next: NextFunction) => {
|
getIncidentById = async (req: Request, res: Response, next: NextFunction) => {
|
||||||
try {
|
try {
|
||||||
const teamId = requireTeamId(req.user?.teamId);
|
const teamId = requireTeamId(req.user?.teamId);
|
||||||
const incidentId = req.params.incidentId;
|
const incidentId = req.params.incidentId as string;
|
||||||
if (!incidentId) {
|
if (!incidentId) {
|
||||||
throw new AppError({ message: "Incident ID is required", service: SERVICE_NAME, status: 400 });
|
throw new AppError({ message: "Incident ID is required", service: SERVICE_NAME, status: 400 });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class MaintenanceWindowController {
|
|||||||
|
|
||||||
const teamId = requireTeamId(req.user?.teamId);
|
const teamId = requireTeamId(req.user?.teamId);
|
||||||
|
|
||||||
const maintenanceWindow = await this.maintenanceWindowService.getMaintenanceWindowById({ id: req.params.id, teamId });
|
const maintenanceWindow = await this.maintenanceWindowService.getMaintenanceWindowById({ id: req.params.id as string, teamId });
|
||||||
|
|
||||||
return res.status(200).json({
|
return res.status(200).json({
|
||||||
success: true,
|
success: true,
|
||||||
@@ -80,7 +80,10 @@ class MaintenanceWindowController {
|
|||||||
|
|
||||||
const teamId = requireTeamId(req?.user?.teamId);
|
const teamId = requireTeamId(req?.user?.teamId);
|
||||||
|
|
||||||
const maintenanceWindows = await this.maintenanceWindowService.getMaintenanceWindowsByMonitorId({ monitorId: req.params.monitorId, teamId });
|
const maintenanceWindows = await this.maintenanceWindowService.getMaintenanceWindowsByMonitorId({
|
||||||
|
monitorId: req.params.monitorId as string,
|
||||||
|
teamId,
|
||||||
|
});
|
||||||
|
|
||||||
return res.status(200).json({
|
return res.status(200).json({
|
||||||
success: true,
|
success: true,
|
||||||
@@ -97,7 +100,7 @@ class MaintenanceWindowController {
|
|||||||
|
|
||||||
const teamId = requireTeamId(req?.user?.teamId);
|
const teamId = requireTeamId(req?.user?.teamId);
|
||||||
|
|
||||||
await this.maintenanceWindowService.deleteMaintenanceWindow({ id: req.params.id, teamId });
|
await this.maintenanceWindowService.deleteMaintenanceWindow({ id: req.params.id as string, teamId });
|
||||||
|
|
||||||
return res.status(200).json({
|
return res.status(200).json({
|
||||||
success: true,
|
success: true,
|
||||||
@@ -115,7 +118,11 @@ class MaintenanceWindowController {
|
|||||||
|
|
||||||
const teamId = requireTeamId(req.user?.teamId);
|
const teamId = requireTeamId(req.user?.teamId);
|
||||||
|
|
||||||
const editedMaintenanceWindow = await this.maintenanceWindowService.editMaintenanceWindow({ id: req.params.id, body: req.body, teamId });
|
const editedMaintenanceWindow = await this.maintenanceWindowService.editMaintenanceWindow({
|
||||||
|
id: req.params.id as string,
|
||||||
|
body: req.body,
|
||||||
|
teamId,
|
||||||
|
});
|
||||||
return res.status(200).json({
|
return res.status(200).json({
|
||||||
success: true,
|
success: true,
|
||||||
msg: "Maintenance window edited successfully",
|
msg: "Maintenance window edited successfully",
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class NotificationController {
|
|||||||
throw new AppError({ message: "Team ID is required", status: 400 });
|
throw new AppError({ message: "Team ID is required", status: 400 });
|
||||||
}
|
}
|
||||||
|
|
||||||
const notificationId = req.params.id;
|
const notificationId = req.params.id as string;
|
||||||
if (!notificationId) {
|
if (!notificationId) {
|
||||||
throw new AppError({ message: "Notification ID is required", status: 400 });
|
throw new AppError({ message: "Notification ID is required", status: 400 });
|
||||||
}
|
}
|
||||||
@@ -115,7 +115,7 @@ class NotificationController {
|
|||||||
getNotificationById = async (req: Request, res: Response, next: NextFunction) => {
|
getNotificationById = async (req: Request, res: Response, next: NextFunction) => {
|
||||||
try {
|
try {
|
||||||
const teamId = requireTeamId(req.user?.teamId);
|
const teamId = requireTeamId(req.user?.teamId);
|
||||||
const notificationId = req.params.id;
|
const notificationId = req.params.id as string;
|
||||||
if (!notificationId) {
|
if (!notificationId) {
|
||||||
throw new AppError({ message: "Notification ID is required", status: 400 });
|
throw new AppError({ message: "Notification ID is required", status: 400 });
|
||||||
}
|
}
|
||||||
@@ -139,7 +139,7 @@ class NotificationController {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const teamId = requireTeamId(req.user?.teamId);
|
const teamId = requireTeamId(req.user?.teamId);
|
||||||
const notificationId = req.params.id;
|
const notificationId = req.params.id as string;
|
||||||
if (!notificationId) {
|
if (!notificationId) {
|
||||||
throw new AppError({ message: "Notification ID is required", status: 400 });
|
throw new AppError({ message: "Notification ID is required", status: 400 });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user