Added checks to monitors for getMonitorsById and getMonitorsByUserId. Added TTL to checks (1 month)

This commit is contained in:
Alex Holliday committed 2024-06-18 12:45:25 -07:00
1 parent b4c5bcbb5f
commit 18df7d8fd5
2 files changed
+44 -25

No files matched your search

+29 -23
View File
@@ -1,28 +1,34 @@
const mongoose = require('mongoose')
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,
}
{
monitorId: {
type: mongoose.Schema.Types.ObjectId,
ref: "Monitor",
immutable: true,
},
{
timestamps: true,
}
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,
}
);
module.exports = mongoose.model('Check', CheckSchema);
module.exports = mongoose.model("Check", CheckSchema);