2024-06-18 12:45:25 -07:00
|
|
|
const mongoose = require("mongoose");
|
2024-05-27 15:07:34 -04:00
|
|
|
|
|
|
|
|
const CheckSchema = mongoose.Schema(
|
2024-06-18 12:45:25 -07:00
|
|
|
{
|
|
|
|
|
monitorId: {
|
|
|
|
|
type: mongoose.Schema.Types.ObjectId,
|
|
|
|
|
ref: "Monitor",
|
|
|
|
|
immutable: true,
|
2024-05-27 15:07:34 -04:00
|
|
|
},
|
2024-06-18 12:45:25 -07:00
|
|
|
status: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
},
|
|
|
|
|
responseTime: {
|
|
|
|
|
type: Number, // milliseconds
|
|
|
|
|
},
|
|
|
|
|
statusCode: {
|
|
|
|
|
type: Number, // 200, ... , 500
|
|
|
|
|
},
|
|
|
|
|
message: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
|
|
|
|
expiry: {
|
|
|
|
|
type: Date,
|
|
|
|
|
default: Date.now,
|
|
|
|
|
expires: 60 * 60 * 24 * 30, // 30 days in seconds
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
timestamps: true,
|
|
|
|
|
}
|
2024-05-27 15:07:34 -04:00
|
|
|
);
|
|
|
|
|
|
2024-06-18 12:45:25 -07:00
|
|
|
module.exports = mongoose.model("Check", CheckSchema);
|