Merge pull request #72 from bluewave-labs/server/models
Added Check and Alert models and updated ReadMe
This commit is contained in:
3 files changed
+85
No files matched your search
@@ -118,6 +118,35 @@ Example:
|
|||||||
|
|
||||||
</details>
|
</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>
|
<details>
|
||||||
|
|||||||
@@ -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);
|
||||||
@@ -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