Merge pull request #2444 from bluewave-labs/fix/maintenance-window-team-id
fix: maintenance window team
This commit is contained in:
1 file changed
+2
-8
@@ -7,8 +7,6 @@ import {
|
|||||||
getMaintenanceWindowsByTeamIdQueryValidation,
|
getMaintenanceWindowsByTeamIdQueryValidation,
|
||||||
deleteMaintenanceWindowByIdParamValidation,
|
deleteMaintenanceWindowByIdParamValidation,
|
||||||
} from "../validation/joi.js";
|
} from "../validation/joi.js";
|
||||||
import jwt from "jsonwebtoken";
|
|
||||||
import { getTokenFromHeaders } from "../utils/utils.js";
|
|
||||||
import { handleValidationError, handleError } from "./controllerUtils.js";
|
import { handleValidationError, handleError } from "./controllerUtils.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "maintenanceWindowController";
|
const SERVICE_NAME = "maintenanceWindowController";
|
||||||
@@ -28,9 +26,7 @@ class MaintenanceWindowController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const token = getTokenFromHeaders(req.headers);
|
const { teamId } = req.user;
|
||||||
const { jwtSecret } = this.settingsService.getSettings();
|
|
||||||
const { teamId } = jwt.verify(token, jwtSecret);
|
|
||||||
const monitorIds = req.body.monitors;
|
const monitorIds = req.body.monitors;
|
||||||
const dbTransactions = monitorIds.map((monitorId) => {
|
const dbTransactions = monitorIds.map((monitorId) => {
|
||||||
return this.db.createMaintenanceWindow({
|
return this.db.createMaintenanceWindow({
|
||||||
@@ -81,9 +77,7 @@ class MaintenanceWindowController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const token = getTokenFromHeaders(req.headers);
|
const { teamId } = req.user;
|
||||||
const { jwtSecret } = this.settingsService.getSettings();
|
|
||||||
const { teamId } = jwt.verify(token, jwtSecret);
|
|
||||||
const maintenanceWindows = await this.db.getMaintenanceWindowsByTeamId(
|
const maintenanceWindows = await this.db.getMaintenanceWindowsByTeamId(
|
||||||
teamId,
|
teamId,
|
||||||
req.query
|
req.query
|
||||||
|
|||||||
Reference in new issue
Block a user