Add getChecksByTeam route

This commit is contained in:
Alex Holliday committed 2024-09-25 11:29:20 +08:00
1 parent 05f1b2b6b4
commit 885a89e36b
2 files changed
+107 -5

No files matched your search

+104
View File
@@ -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": []
}
]
}
}
},
+3 -5
View File
@@ -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"]),