diff --git a/README.md b/README.md
index daf504923..c93ee1434 100644
--- a/README.md
+++ b/README.md
@@ -9,6 +9,9 @@ BlueWave uptime monitoring application
1. [Installation (Client)](#client)
2. [Installation (Server)](#server)
3. [Configuration(Server)](#config-server)
+ - [Environment](#environmental-variables)
+ - [Database](#databases)
+ - [Docker Images](#docker-images)
4. [Endpoints](#endpoints)
###### Auth
- POST [/api/v1/auth/register](#post-register)
@@ -59,9 +62,11 @@ BlueWave uptime monitoring application
---
-#### Configuration {#config-server}
+#### Configuration
-Configure the server with the following environmental variables
+##### Environmental Variables
+
+Configure the server with the following environmental variables:
| ENV Variable Name | Required/Optional | Type | Description | Accepted Values |
| -------------------- | ----------------- | --------- | ------------------------------------------------------------------------------------------- | ------------------- |
@@ -74,6 +79,45 @@ Configure the server with the following environmental variables
---
+##### Databases
+
+This project requires a number of databases to run:
+
+1. Main database for the application. This project includes an implementation for a MongoDB database as well as a MongoDB Docker image.
+2. A Redis database is required for the Queue implementation in the PingService. This project includes a Redis docker image.
+
+You may run your own databases locally, or you may use the docker images included in the project to get up and running quickly.
+
+###### (Optional) Running Docker Images
+
+Docker images are located in `./Server/docker`
+
+
+MongoDB Image
+Located in `./Server/docker/mongo`
+
+The `./Server/docker/mongo/mongo_data` folder should be mounted to the MongoDB container in order to persist data.
+
+From the `mongo` folder run
+
+1. Build the image: `docker build -t .`
+2. Run the docker image: `docker run -d -p 27017:27017 -v $(pwd)/../mongo/mongo_data:/data/db --name uptime_database_mongo uptime_database_mongo`
+
+
+
+Redis Image
+Located in `./Server/docker/redis`
+
+the `./Server/docker/redis/redis_data` folder should be mounted to the Redis container in order to persist data.
+
+From the `Redis` folder run
+
+1. Build the image: `docker build -t `
+2. Run the image: `docker run -d -p 6379:6379 -v $(pwd)/../redis/redis_data:/data --name uptime_redis uptime_redis`
+
+
+---
+
#### Starting the Development Server
1. run `npm run dev` to start the development server
@@ -1110,7 +1154,475 @@ curl --request POST \
---
-### Error handling {#error-handling}
+###### Checks
+
+
+POST/api/v1/checks/{monitorId}
+
+###### Method/Headers
+
+> | Method/Headers | Value |
+> | -------------- | ----- |
+> | Method | POST |
+
+###### Response Payload
+
+> | Type | Notes |
+> | ------- | --------------------------- |
+> | `Check` | Returns newly created check |
+
+###### Body
+
+> | Name | Type | Notes |
+> | ------------ | --------- | -------------------------------------- |
+> | monitorId | `string` | Monitor associated with Check |
+> | status | `boolean` | `true` for up and `false` for down |
+> | responseTime | `number` | How long it took the server to respond |
+> | statusCode | `number` | HTTP Status code of response |
+> | message | `string` | |
+
+##### Sample CURL request
+
+```
+curl --request POST \
+ --url http://localhost:5000/api/v1/checks/66562414035c4ce6a8a610ac \
+ --header 'Authorization: ' \
+ --header 'Content-Type: application/json' \
+ --data '{
+ "monitorId": "66562414035c4ce6a8a610ac",
+ "status": true,
+ "responseTime": 1,
+ "statusCode": 200,
+ "message": "good"
+}'
+```
+
+###### Sample Response
+
+```json
+{
+ "success": true,
+ "msg": "Check created",
+ "data": {
+ "monitorId": "66562414035c4ce6a8a610ac",
+ "status": true,
+ "responseTime": 1,
+ "statusCode": 200,
+ "message": "good",
+ "_id": "66576decba9f70148ea1f354",
+ "createdAt": "2024-05-29T18:03:24.445Z",
+ "updatedAt": "2024-05-29T18:03:24.445Z",
+ "__v": 0
+ }
+}
+```
+
+
+
+
+GET/api/v1/checks/{monitorId}
+
+###### Method/Headers
+
+> | Method/Headers | Value |
+> | -------------- | ----- |
+> | Method | GET |
+
+###### Response Payload
+
+> | Type | Notes |
+> | --------------- | ------------------------ |
+> | `Array` | Array of `Check` objects |
+
+##### Sample CURL request
+
+```
+curl --request GET \
+ --url http://localhost:5000/api/v1/checks/66562414035c4ce6a8a610ac \
+ --header 'Authorization: ' \
+```
+
+###### Sample Response
+
+```json
+{
+ "success": true,
+ "msg": "Checks retrieved",
+ "data": [
+ {
+ "_id": "66576c0194e11c0d4409d3c1",
+ "monitorId": "66562414035c4ce6a8a610ac",
+ "status": true,
+ "responseTime": 1,
+ "statusCode": 200,
+ "message": "good",
+ "createdAt": "2024-05-29T17:55:13.581Z",
+ "updatedAt": "2024-05-29T17:55:13.581Z",
+ "__v": 0
+ },
+ {
+ "_id": "66576c0994e11c0d4409d3c5",
+ "monitorId": "66562414035c4ce6a8a610ac",
+ "status": true,
+ "responseTime": 2,
+ "statusCode": 200,
+ "message": "good",
+ "createdAt": "2024-05-29T17:55:21.127Z",
+ "updatedAt": "2024-05-29T17:55:21.127Z",
+ "__v": 0
+ }
+ ]
+}
+```
+
+
+
+
+POST/api/v1/checks/delete/{monitorId}
+
+###### Method/Headers
+
+> | Method/Headers | Value |
+> | -------------- | ----- |
+> | Method | POST |
+
+###### Response Payload
+
+> | Type | Notes |
+> | -------- | -------------------------------------------------------------------- |
+> | `Object` | `{deletedCount: n}` Returns an object showing how many items deleted |
+
+##### Sample CURL request
+
+```
+curl --request POST \
+ --url http://localhost:5000/api/v1/checks/delete/66562414035c4ce6a8a610ac \
+ --header 'Authorization: ' \
+```
+
+###### Sample Response
+
+```json
+{
+ "success": true,
+ "msg": "Checks deleted",
+ "data": {
+ "deletedCount": 3
+ }
+}
+```
+
+
+
+---
+
+###### Alerts
+
+
+POST/api/v1/alerts/{monitorId}
+
+###### Method/Headers
+
+> | Method/Headers | Value |
+> | -------------- | ----- |
+> | Method | POST |
+
+###### Response Payload
+
+> | Type | Notes |
+> | ------- | ----------------------------- |
+> | `Alert` | Returns newly created `Alert` |
+
+###### Body
+
+ "checkId": "66577a3fd16dcf7c1ce35148",
+ "monitorId": "6657789ebf6766ee8e2d2edb",
+ "userId": "6654d1a2634754f789e1f115",
+ "status": false,
+ "message": "This is a test alert",
+ "notifiedStatus": "false",
+ "acknowledgeStatus": false
+
+> | Name | Type | Notes |
+> | ----------------- | --------- | --------------------------------------- |
+> | checkId | `string` | Id of `Check` associated with `Alert` |
+> | monitorId | `string` | Id of `Monitor` associated with `Alert` |
+> | userId | `string` | Id of `User` associated with `Alert` |
+> | status | `boolean` | Status of `Alert` |
+> | message | `string` | `Alert` message |
+> | notifiedStatus | `boolean` | |
+> | acknowledgeStatus | `boolean` | |
+
+##### Sample CURL request
+
+```
+
+```
+
+###### Sample Response
+
+```json
+
+```
+
+
+
+
+GET/api/v1/alerts/user/{userId}
+
+###### Method/Headers
+
+> | Method/Headers | Value |
+> | -------------- | ----- |
+> | Method | GET |
+
+###### Response Payload
+
+> | Type | Notes |
+> | -------------- | --------------------------------------- |
+> | `Array` | Returns all `Alert` created by a `User` |
+
+##### Sample CURL request
+
+```
+curl --request GET \
+ --url http://localhost:5000/api/v1/alerts/user/6654d1a2634754f789e1f115 \
+ --header 'Authorization: '
+```
+
+###### Sample Response
+
+```json
+{
+ "success": true,
+ "msg": "Got alerts",
+ "data": [
+ {
+ "_id": "6657813d809adfded891a6b7",
+ "checkId": "66577a3fd16dcf7c1ce35148",
+ "monitorId": "6657789ebf6766ee8e2d2edb",
+ "userId": "6654d1a2634754f789e1f115",
+ "status": false,
+ "message": "This is a test alert",
+ "notifiedStatus": false,
+ "acknowledgeStatus": false,
+ "createdAt": "2024-05-29T19:25:49.317Z",
+ "updatedAt": "2024-05-29T19:25:49.317Z",
+ "__v": 0
+ }
+ ]
+}
+```
+
+
+
+GET/api/v1/alerts/monitor/{monitorId}
+
+###### Method/Headers
+
+> | Method/Headers | Value |
+> | -------------- | ----- |
+> | Method | GET |
+
+###### Response Payload
+
+> | Type | Notes |
+> | -------------- | -------------------------------------------------------------- |
+> | `Array` | Returns an array of `Alert` belonging to a specified `Monitor` |
+
+##### Sample CURL request
+
+```
+curl --request GET \
+ --url http://localhost:5000/api/v1/alerts/monitor/6657789ebf6766ee8e2d2edb \
+ --header 'Authorization: ' \
+```
+
+###### Sample Response
+
+```json
+{
+ "success": true,
+ "msg": "Got alerts by Monitor",
+ "data": [
+ {
+ "_id": "6657813d809adfded891a6b7",
+ "checkId": "66577a3fd16dcf7c1ce35148",
+ "monitorId": "6657789ebf6766ee8e2d2edb",
+ "userId": "6654d1a2634754f789e1f115",
+ "status": false,
+ "message": "This is a test alert",
+ "notifiedStatus": false,
+ "acknowledgeStatus": false,
+ "createdAt": "2024-05-29T19:25:49.317Z",
+ "updatedAt": "2024-05-29T19:25:49.317Z",
+ "__v": 0
+ }
+ ]
+}
+```
+
+
+
+
+GET/api/v1/alerts/{alertId}
+
+###### Method/Headers
+
+> | Method/Headers | Value |
+> | -------------- | ----- |
+> | Method | GET |
+
+###### Response Payload
+
+> | Type | Notes |
+> | ------- | ------------------------- |
+> | `Alert` | Returns specified `Alert` |
+
+##### Sample CURL request
+
+```
+curl --request GET \
+ --url http://localhost:5000/api/v1/alerts/66577ddae5ff3c91437d0887 \
+ --header 'Authorization: ' \
+```
+
+###### Sample Response
+
+```json
+{
+ "success": true,
+ "msg": "Got Alert By alertID",
+ "data": {
+ "_id": "66577ddae5ff3c91437d0887",
+ "checkId": "66577a3fd16dcf7c1ce35148",
+ "monitorId": "6657789ebf6766ee8e2d2edb",
+ "userId": "6654d1a2634754f789e1f115",
+ "status": false,
+ "message": "This is a test alert",
+ "notifiedStatus": false,
+ "acknowledgeStatus": false,
+ "createdAt": "2024-05-29T19:11:22.205Z",
+ "updatedAt": "2024-05-29T19:11:22.205Z",
+ "__v": 0
+ }
+}
+```
+
+
+
+
+POST/api/v1/alerts/edit/{alertId}
+
+###### Method/Headers
+
+> | Method/Headers | Value |
+> | -------------- | ----- |
+> | Method | POST |
+
+###### Response Payload
+
+> | Type | Notes |
+> | ------- | ---------------------- |
+> | `Alert` | Returns edited `Alert` |
+
+###### Body
+
+> | Name | Type | Notes |
+> | ----------------- | --------- | ------------------------------------------ |
+> | checkId | `string` | ID of `Check` associated with `Alert` |
+> | monitorId | `string` | ID of `Monitor` id associated with `Alert` |
+> | userId | `string` | ID of `User` associated with `Alert` |
+> | status | `boolean` | Alert status |
+> | message | `string` | Alert message |
+> | notifiedStatus | `boolean` | |
+> | acknowledgeStatus | `boolean` | |
+
+##### Sample CURL request
+
+```
+curl --request POST \
+ --url http://localhost:5000/api/v1/alerts/edit/66577ddae5ff3c91437d0887 \
+ --header 'Authorization: ' \
+ --header 'Content-Type: application/json' \
+ --data '{
+ "acknowledgeStatus": true
+}'
+```
+
+###### Sample Response
+
+```json
+{
+ "success": true,
+ "msg": "Edited alert",
+ "data": {
+ "_id": "66577ddae5ff3c91437d0887",
+ "checkId": "66577a3fd16dcf7c1ce35148",
+ "monitorId": "6657789ebf6766ee8e2d2edb",
+ "userId": "6654d1a2634754f789e1f115",
+ "status": false,
+ "message": "This is a test alert",
+ "notifiedStatus": false,
+ "acknowledgeStatus": true,
+ "createdAt": "2024-05-29T19:11:22.205Z",
+ "updatedAt": "2024-05-29T19:12:23.951Z",
+ "__v": 0
+ }
+}
+```
+
+
+
+POST/api/v1/alerts/delete/{alertId}
+
+###### Method/Headers
+
+> | Method/Headers | Value |
+> | -------------- | ----- |
+> | Method | POST |
+
+###### Response Payload
+
+> | Type | Notes |
+> | ------- | --------------------------- |
+> | `Alert` | Returns the deleted `Alert` |
+
+##### Sample CURL request
+
+```
+curl --request POST \
+ --url http://localhost:5000/api/v1/alerts/delete/66577ddae5ff3c91437d0887 \
+ --header 'Authorization: ' \
+```
+
+###### Sample Response
+
+```json
+{
+ "success": true,
+ "msg": "Deleted alert",
+ "data": {
+ "_id": "66577ddae5ff3c91437d0887",
+ "checkId": "66577a3fd16dcf7c1ce35148",
+ "monitorId": "6657789ebf6766ee8e2d2edb",
+ "userId": "6654d1a2634754f789e1f115",
+ "status": false,
+ "message": "This is a test alert",
+ "notifiedStatus": false,
+ "acknowledgeStatus": true,
+ "createdAt": "2024-05-29T19:11:22.205Z",
+ "updatedAt": "2024-05-29T19:12:23.951Z",
+ "__v": 0
+ }
+}
+```
+
+
+
+---
+
+### Error handling
Errors are returned in a standard format:
diff --git a/Server/.gitignore b/Server/.gitignore
index 3fdb59050..51b2eb44c 100644
--- a/Server/.gitignore
+++ b/Server/.gitignore
@@ -1,3 +1,6 @@
node_modules
.env
-*.log
\ No newline at end of file
+*.log
+*.sh
+docker/mongo/mongo_data/*
+docker/redis/redis_data/*
\ No newline at end of file
diff --git a/Server/docker/mongo/Dockerfile b/Server/docker/mongo/Dockerfile
new file mode 100644
index 000000000..fa79e8a92
--- /dev/null
+++ b/Server/docker/mongo/Dockerfile
@@ -0,0 +1,2 @@
+FROM mongo
+EXPOSE 27017
\ No newline at end of file
diff --git a/Server/docker/redis/Dockerfile b/Server/docker/redis/Dockerfile
new file mode 100644
index 000000000..af68ec61e
--- /dev/null
+++ b/Server/docker/redis/Dockerfile
@@ -0,0 +1,2 @@
+FROM redis
+EXPOSE 6379
\ No newline at end of file