mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-01-18 07:39:54 -06:00
Merge pull request #72 from bluewave-labs/server/models
Added Check and Alert models and updated ReadMe
This commit is contained in:
29
README.md
29
README.md
@@ -118,6 +118,35 @@ Example:
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><code>Check</code></summary>
|
||||
|
||||
| Name | Type | Notes |
|
||||
| ----------- | --------- | ------------------------------------------------|
|
||||
| monitorId | `string` | Unique ID for the monitor |
|
||||
| status | `boolean` | Indicates the service is Up or Down |
|
||||
| responseTime| `integer` | Indicates the response time of the service (ms) |
|
||||
| statusCode | `integer` | Status Code returned from the service |
|
||||
| message | `string` | Message returned from the service |
|
||||
| updatedAt | `Date` | Last time the check was updated |
|
||||
| CreatedAt | `Date` | When the check was created |
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><code>Alert</code></summary>
|
||||
|
||||
| Name | Type | Notes |
|
||||
| ----------- | --------- | --------------------------------------------------|
|
||||
| checkId | `string` | Unique ID for the check |
|
||||
| status | `boolean` | Indicates the service is Up or Down |
|
||||
| message | `string` | Message for the user about the down service |
|
||||
| notifiedStatus | `boolean` | Indicates whether the user is notified |
|
||||
| acknowledgeStatus | `boolean` | Indicates whether the user acknowledged the alert |
|
||||
| updatedAt | `Date` | Last time the alert was updated |
|
||||
| CreatedAt | `Date` | When the alert was created |
|
||||
|
||||
</details>
|
||||
---
|
||||
|
||||
<details>
|
||||
|
||||
28
Server/models/Alert.js
Normal file
28
Server/models/Alert.js
Normal file
@@ -0,0 +1,28 @@
|
||||
const mongoose = require('mongoose')
|
||||
|
||||
const AlertSchema = mongoose.Schema(
|
||||
{
|
||||
checkId: {
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
ref: 'Check',
|
||||
immutable: true,
|
||||
},
|
||||
status: {
|
||||
type: Boolean,
|
||||
},
|
||||
message: {
|
||||
type: String,
|
||||
},
|
||||
notifiedStatus: {
|
||||
type: Boolean,
|
||||
},
|
||||
acknowledgeStatus: {
|
||||
type: Boolean,
|
||||
}
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
}
|
||||
);
|
||||
|
||||
module.exports = mongoose.model('Alert', AlertSchema);
|
||||
28
Server/models/Check.js
Normal file
28
Server/models/Check.js
Normal file
@@ -0,0 +1,28 @@
|
||||
const mongoose = require('mongoose')
|
||||
|
||||
const CheckSchema = mongoose.Schema(
|
||||
{
|
||||
monitorId: {
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
ref: 'Monitor',
|
||||
immutable: true,
|
||||
},
|
||||
status: {
|
||||
type: Boolean,
|
||||
},
|
||||
responseTime: {
|
||||
type: Number, // milliseconds
|
||||
},
|
||||
statusCode: {
|
||||
type: Number, // 200, ... , 500
|
||||
},
|
||||
message: {
|
||||
type: String,
|
||||
}
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
}
|
||||
);
|
||||
|
||||
module.exports = mongoose.model('Check', CheckSchema);
|
||||
Reference in New Issue
Block a user