Added Check and Alert models and updated ReadMe

This commit is contained in:
veyselboybay committed 2024-05-27 15:07:34 -04:00
1 parent b945c73c87
commit 36936266ac
3 files changed
+85

No files matched your search

+28
View 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
View 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);