Feat/monitor endpoint refactor (#463)

* Moved all methods to modules

* removed old mongoDB file

* Refactored endpoints to take query params, removed duplicate methods, updated routes, updated Client queries

* Added comment

* Add model differentiation

* Add sort order, fix minor bug, add validation for query params
This commit is contained in:
Alexander Holliday authored and GitHub committed 2024-07-26 18:56:39 -07:00
1 parent e47d3685ce
commit 477cad7cc9
11 files changed
+132 -166

No files matched your search

+19 -6
View File
@@ -6,16 +6,12 @@
![](https://img.shields.io/github/issues-pr/bluewave-labs/bluewave-uptime)
![](https://img.shields.io/github/issues/bluewave-labs/bluewave-uptime)
<h1 align="center"><a href="https://bluewavelabs.ca" target="_blank">BlueWave Uptime</a></h1>
<p align="center"><strong>An open source server monitoring application</strong></p>
![bluewave-uptime-screenshot](https://github.com/user-attachments/assets/765bf060-e734-45e6-bd00-2a2eb37c9c02)
BlueWave Uptime is an open source server monitoring application used to track the operational status and performance of servers and websites. It regularly checks whether a server/website is accessible and performs optimally, providing real-time alerts and reports on the monitored services' availability, downtime, and response time.
## Contributing
@@ -776,7 +772,7 @@ curl --request GET \
</details>
<details>
<summary id='get-monitor-id'><code>GET</code> <b>/api/v1/monitor/{id}</b></summary>
<summary id='get-monitor-id'><code>GET</code> <b>/api/v1/monitor/{id}?status</b></summary>
###### Method/Headers
@@ -785,6 +781,14 @@ curl --request GET \
> | Method | GET |
> | content-type | application/json |
###### Query Params
> | Name | Type | Required | Notes |
> | --------- | --------- | -------- | ------------------------------------------------ |
> | status | `boolean` | Optional | Check status |
> | limit | `number` | Optional | Number of checks to return |
> | sortOrder | `string` | Optional | `desc`:Newest -> Oldest, `asc`: Oldest -> Newest |
###### Response Payload
> | Type | Notes |
@@ -795,7 +799,7 @@ curl --request GET \
```
curl --request GET \
--url http://localhost:5000/api/v1/monitors/664d070786e62625ac612ca1 \
--url http://localhost:5000/api/v1/monitors/664d070786e62625ac612ca1?status=true?limit=0 \
--header '<bearer_token>' \
```
@@ -857,6 +861,15 @@ curl --request GET \
> | Method | GET |
> | content-type | application/json |
###### Query Params
> | Name | Type | Required | Notes |
> | --------- | --------- | -------- | ------------------------------------------------- |
> | status | `boolean` | Optional | Check status |
> | type | `string` | Optional | Multiple allowed: `http` \| `ping` \| `pagespeed` |
> | limit | `number` | Optional | Monitor status |
> | sortOrder | `string` | Optional | `desc`:Newest -> Oldest, `asc`: Oldest -> Newest |
###### Response Payload
> | Type | Notes |