Merge branch 'develop' into 1063-fe-hardware-montioring-monitor-gauge

This commit is contained in:
Shemy Gan
2024-11-01 09:14:18 -04:00
8 changed files with 94 additions and 131 deletions
+4 -4
View File
@@ -29,7 +29,7 @@
"react-router": "^6.23.0",
"react-router-dom": "^6.23.1",
"react-toastify": "^10.0.5",
"recharts": "2.13.1",
"recharts": "2.13.2",
"redux-persist": "6.0.0",
"vite-plugin-svgr": "^4.2.0"
},
@@ -5518,9 +5518,9 @@
}
},
"node_modules/recharts": {
"version": "2.13.1",
"resolved": "https://registry.npmjs.org/recharts/-/recharts-2.13.1.tgz",
"integrity": "sha512-87LdsmgK/MHLmWQfTC6yDysno2cOigi/+2KRCwy0D8NDu1IOdtTGS8lMovA0VIvJ7kf3zdp1IiwznHZWSPJhYw==",
"version": "2.13.2",
"resolved": "https://registry.npmjs.org/recharts/-/recharts-2.13.2.tgz",
"integrity": "sha512-UDLGFmnsBluDIPpQb9uty0ejb+jiVI71vkki8vVsR6ZCJdgjBfKQoQfft4re99CKlTy9qjQApxCLG6TrxJkeAg==",
"license": "MIT",
"dependencies": {
"clsx": "^2.0.0",
+1 -1
View File
@@ -32,7 +32,7 @@
"react-router": "^6.23.0",
"react-router-dom": "^6.23.1",
"react-toastify": "^10.0.5",
"recharts": "2.13.1",
"recharts": "2.13.2",
"redux-persist": "6.0.0",
"vite-plugin-svgr": "^4.2.0"
},
+1 -1
View File
@@ -2,7 +2,7 @@ services:
client:
image: uptime_client:latest
environment:
UPTIME_APP_API_BASE_URL: "http://localhost:5000/api/v1"
UPTIME_APP_API_BASE_URL: "https://uptime-demo.bluewavelabs.ca/api/v1"
ports:
- "80:80"
- "443:443"
+61 -66
View File
@@ -1,6 +1,63 @@
import mongoose from "mongoose";
import EmailService from "../../service/emailService.js";
import Notification from "./Notification.js";
const BaseCheckSchema = mongoose.Schema({
/**
* Reference to the associated Monitor document.
*
* @type {mongoose.Schema.Types.ObjectId}
*/
monitorId: {
type: mongoose.Schema.Types.ObjectId,
ref: "Monitor",
immutable: true,
index: true,
},
/**
* Status of the check (true for up, false for down).
*
* @type {Boolean}
*/
status: {
type: Boolean,
index: true,
},
/**
* Response time of the check in milliseconds.
*
* @type {Number}
*/
responseTime: {
type: Number,
},
/**
* HTTP status code received during the check.
*
* @type {Number}
*/
statusCode: {
type: Number,
index: true,
},
/**
* Message or description of the check result.
*
* @type {String}
*/
message: {
type: String,
},
/**
* Expiry date of the check, auto-calculated to expire after 30 days.
*
* @type {Date}
*/
expiry: {
type: Date,
default: Date.now,
expires: 60 * 60 * 24 * 30, // 30 days
},
});
/**
* Check Schema for MongoDB collection.
@@ -8,69 +65,7 @@ import Notification from "./Notification.js";
* Represents a check associated with a monitor, storing information
* about the status and response of a particular check event.
*/
const CheckSchema = mongoose.Schema(
{
/**
* Reference to the associated Monitor document.
*
* @type {mongoose.Schema.Types.ObjectId}
*/
monitorId: {
type: mongoose.Schema.Types.ObjectId,
ref: "Monitor",
immutable: true,
index: true,
},
/**
* Status of the check (true for up, false for down).
*
* @type {Boolean}
*/
status: {
type: Boolean,
index: true,
},
/**
* Response time of the check in milliseconds.
*
* @type {Number}
*/
responseTime: {
type: Number,
},
/**
* HTTP status code received during the check.
*
* @type {Number}
*/
statusCode: {
type: Number,
index: true,
},
/**
* Message or description of the check result.
*
* @type {String}
*/
message: {
type: String,
},
/**
* Expiry date of the check, auto-calculated to expire after 30 days.
*
* @type {Date}
*/
expiry: {
type: Date,
default: Date.now,
expires: 60 * 60 * 24 * 30, // 30 days
},
},
{
timestamps: true, // Adds createdAt and updatedAt timestamps
}
);
const CheckSchema = mongoose.Schema({ ...BaseCheckSchema.obj }, { timestamps: true });
CheckSchema.index({ createdAt: 1 });
export default mongoose.model("Check", CheckSchema);
export { BaseCheckSchema };
+4 -30
View File
@@ -1,5 +1,5 @@
import mongoose from "mongoose";
import { BaseCheckSchema } from "./Check.js";
const cpuSchema = mongoose.Schema({
physical_core: { type: Number, default: 0 },
logical_core: { type: Number, default: 0 },
@@ -32,35 +32,7 @@ const hostSchema = mongoose.Schema({
const HardwareCheckSchema = mongoose.Schema(
{
monitorId: {
type: mongoose.Schema.Types.ObjectId,
ref: "Monitor",
immutable: true,
index: true,
},
status: {
type: Boolean,
index: true,
},
responseTime: {
type: Number,
},
statusCode: {
type: Number,
index: true,
},
message: {
type: String,
},
expiry: {
type: Date,
default: Date.now,
expires: 60 * 60 * 24 * 30, // 30 days
},
...BaseCheckSchema.obj,
cpu: {
type: cpuSchema,
default: () => ({}),
@@ -81,4 +53,6 @@ const HardwareCheckSchema = mongoose.Schema(
{ timestamps: true }
);
HardwareCheckSchema.index({ createdAt: 1 });
export default mongoose.model("HardwareCheck", HardwareCheckSchema);
+6 -12
View File
@@ -1,5 +1,7 @@
import mongoose from "mongoose";
import { BaseCheckSchema } from "./Check.js";
import logger from "../../utils/logger.js";
import { time } from "console";
const AuditSchema = mongoose.Schema({
id: { type: String, required: true },
title: { type: String, required: true },
@@ -46,15 +48,7 @@ const AuditsSchema = mongoose.Schema({
const PageSpeedCheck = mongoose.Schema(
{
monitorId: {
type: mongoose.Schema.Types.ObjectId,
ref: "Monitor",
immutable: true,
},
status: {
type: Boolean,
required: true,
},
...BaseCheckSchema.obj,
accessibility: {
type: Number,
required: true,
@@ -76,9 +70,7 @@ const PageSpeedCheck = mongoose.Schema(
required: true,
},
},
{
timestamps: true,
}
{ timestamps: true }
);
/**
@@ -112,4 +104,6 @@ PageSpeedCheck.pre("save", async function (next) {
}
});
PageSpeedCheck.index({ createdAt: 1 });
export default mongoose.model("PageSpeedCheck", PageSpeedCheck);
+15 -15
View File
@@ -12,7 +12,7 @@
"@sendgrid/mail": "^8.1.3",
"axios": "^1.7.2",
"bcrypt": "^5.1.1",
"bullmq": "5.21.2",
"bullmq": "5.22.0",
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"express": "^4.19.2",
@@ -35,7 +35,7 @@
"c8": "10.1.2",
"chai": "5.1.2",
"esm": "3.2.25",
"mocha": "10.8.1",
"mocha": "10.8.2",
"nodemon": "3.1.7",
"prettier": "^3.3.3",
"sinon": "19.0.2"
@@ -1164,9 +1164,9 @@
"license": "MIT"
},
"node_modules/bullmq": {
"version": "5.21.2",
"resolved": "https://registry.npmjs.org/bullmq/-/bullmq-5.21.2.tgz",
"integrity": "sha512-LPuNoGaDc5CON2X6h4cJ2iVfd+B+02xubFU+IB/fyJHd+/HqUZRqnlYryUCAuhVHBhUKtA6oyVdJxqSa62i+og==",
"version": "5.22.0",
"resolved": "https://registry.npmjs.org/bullmq/-/bullmq-5.22.0.tgz",
"integrity": "sha512-nwjJSQt/kpO4bIfAznyKKz3+m5OZ6YSaz2Vg7oNoZWTD5wCnJJJy6b9iWM5QIF0bADhDWyorLCO0hU3de+iKMA==",
"license": "MIT",
"dependencies": {
"cron-parser": "^4.6.0",
@@ -4129,9 +4129,9 @@
}
},
"node_modules/mocha": {
"version": "10.8.1",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-10.8.1.tgz",
"integrity": "sha512-WxSpEWgF03HfgNKBuysfK40DUaOSVX5zxgLDoieMGO+zyE69iq2eQ1vBypvIJ5mOPKpuVAqWiTbt4Orj7L6wVw==",
"version": "10.8.2",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-10.8.2.tgz",
"integrity": "sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -4314,9 +4314,9 @@
}
},
"node_modules/mongodb": {
"version": "6.9.0",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.9.0.tgz",
"integrity": "sha512-UMopBVx1LmEUbW/QE0Hw18u583PEDVQmUmVzzBRH0o/xtE9DBRA5ZYLOjpLIa03i8FXjzvQECJcqoMvCXftTUA==",
"version": "6.10.0",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.10.0.tgz",
"integrity": "sha512-gP9vduuYWb9ZkDM546M+MP2qKVk5ZG2wPF63OvSRuUbqCR+11ZCAE1mOfllhlAG0wcoJY5yDL/rV3OmYEwXIzg==",
"license": "Apache-2.0",
"dependencies": {
"@mongodb-js/saslprep": "^1.1.5",
@@ -4369,14 +4369,14 @@
}
},
"node_modules/mongoose": {
"version": "8.7.3",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.7.3.tgz",
"integrity": "sha512-Xl6+dzU5ZpEcDoJ8/AyrIdAwTY099QwpolvV73PIytpK13XqwllLq/9XeVzzLEQgmyvwBVGVgjmMrKbuezxrIA==",
"version": "8.8.0",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.8.0.tgz",
"integrity": "sha512-KluvgwnQB1GPOYZZXUHJRjS1TW6xxwTlf/YgjWExuuNanIe3W7VcR7dDXQVCIRk8L7NYge8EnoTcu2grWtN+XQ==",
"license": "MIT",
"dependencies": {
"bson": "^6.7.0",
"kareem": "2.6.3",
"mongodb": "6.9.0",
"mongodb": "~6.10.0",
"mpath": "0.9.0",
"mquery": "5.0.0",
"ms": "2.1.3",
+2 -2
View File
@@ -15,7 +15,7 @@
"@sendgrid/mail": "^8.1.3",
"axios": "^1.7.2",
"bcrypt": "^5.1.1",
"bullmq": "5.21.2",
"bullmq": "5.22.0",
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"express": "^4.19.2",
@@ -38,7 +38,7 @@
"c8": "10.1.2",
"chai": "5.1.2",
"esm": "3.2.25",
"mocha": "10.8.1",
"mocha": "10.8.2",
"nodemon": "3.1.7",
"prettier": "^3.3.3",
"sinon": "19.0.2"