diff --git a/Server/openapi.json b/Server/openapi.json index 28718098f..d33fb03e1 100644 --- a/Server/openapi.json +++ b/Server/openapi.json @@ -1513,6 +1513,110 @@ "bearerAuth": [] } ] + }, + "delete": { + "tags": ["checks"], + "description": "Delete all checks for a 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": [] + } + ] + } + }, + "/checks/team/{teamId}": { + "get": { + "tags": ["checks"], + "description": "Get all checks for a team", + "parameters": [ + { + "name": "teamId", + "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": [] + } + ] } } }, diff --git a/Server/routes/checkRoute.js b/Server/routes/checkRoute.js index a26e9eb94..84e7f47a8 100644 --- a/Server/routes/checkRoute.js +++ b/Server/routes/checkRoute.js @@ -4,22 +4,20 @@ const { verifyOwnership } = require("../middleware/verifyOwnership"); const { isAllowed } = require("../middleware/isAllowed"); const Monitor = require("../models/Monitor"); +router.get("/:monitorId", checkController.getChecks); router.post( "/:monitorId", verifyOwnership(Monitor, "monitorId"), checkController.createCheck ); - -router.get("/:monitorId", checkController.getChecks); - -router.get("/team/:teamId", checkController.getTeamChecks); - router.delete( "/:monitorId", verifyOwnership(Monitor, "monitorId"), checkController.deleteChecks ); +router.get("/team/:teamId", checkController.getTeamChecks); + router.delete( "/team/:teamId", isAllowed(["admin", "superadmin"]),