Add maintenance window routes to docs

This commit is contained in:
Alex Holliday
2024-09-25 12:11:18 +08:00
parent f2407ac5fa
commit 35d2d8301e
2 changed files with 204 additions and 7 deletions
+197
View File
@@ -53,6 +53,10 @@
{
"name": "maintenance-window",
"description": "Maintenance window"
},
{
"name": "queue",
"description": "Queue"
}
],
"paths": {
@@ -1705,6 +1709,172 @@
}
]
}
},
"/maintenance-window/monitor/{monitorId}": {
"get": {
"tags": ["maintenance-window"],
"description": "Get maintenance window for monitor",
"parameters": [
{
"name": "monitorId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SuccessResponse"
}
}
}
},
"422": {
"description": "Unprocessable Content",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"500": {
"description": "Internal Server Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
},
"post": {
"tags": ["maintenance-window"],
"description": "Create maintenance window for monitor",
"parameters": [
{
"name": "monitorId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateMaintenanceWindowBody"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SuccessResponse"
}
}
}
},
"422": {
"description": "Unprocessable Content",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"500": {
"description": "Internal Server Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
}
},
"/maintenance-window/user/{userId}": {
"get": {
"tags": ["maintenance-window"],
"description": "Get maintenance window for user",
"parameters": [
{
"name": "userId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SuccessResponse"
}
}
}
},
"422": {
"description": "Unprocessable Content",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"500": {
"description": "Internal Server Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
}
}
},
@@ -1878,6 +2048,33 @@
"type": "integer"
}
}
},
"CreateMaintenanceWindowBody": {
"type": "object",
"required": ["userId", "active", "oneTime", "start", "end"],
"properties": {
"userId": {
"type": "string"
},
"active": {
"type": "boolean"
},
"oneTime": {
"type": "boolean"
},
"start": {
"type": "string",
"format": "date-time"
},
"end": {
"type": "string",
"format": "date-time"
},
"expiry": {
"type": "string",
"format": "date-time"
}
}
}
}
}
+7 -7
View File
@@ -3,8 +3,14 @@ const maintenanceWindowController = require("../controllers/maintenanceWindowCon
const { verifyOwnership } = require("../middleware/verifyOwnership");
const Monitor = require("../models/Monitor");
router.get(
"/monitor/:monitorId",
verifyOwnership(Monitor, "monitorId"),
maintenanceWindowController.getMaintenanceWindowsByMonitorId
);
router.post(
"/:monitorId",
"/monitor/:monitorId",
verifyOwnership(Monitor, "monitorId"),
maintenanceWindowController.createMaintenanceWindow
);
@@ -14,10 +20,4 @@ router.get(
maintenanceWindowController.getMaintenanceWindowsByUserId
);
router.get(
"/monitor/:monitorId",
verifyOwnership(Monitor, "monitorId"),
maintenanceWindowController.getMaintenanceWindowsByMonitorId
);
module.exports = router;