Merge remote-tracking branch 'upstream/master' into feat/form-validation
This commit is contained in:
commit
2a77c3fc12
3 files changed
+49
-1
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
./docker
|
||||||
@@ -293,7 +293,7 @@ const getMonitorById = async (req, res) => {
|
|||||||
*/
|
*/
|
||||||
const getMonitorsByUserId = async (req, res) => {
|
const getMonitorsByUserId = async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const limit = req.query.limit;
|
const limit = req.query ? req.query.limit : undefined;
|
||||||
const monitors = await Monitor.find({ userId: req.params.userId });
|
const monitors = await Monitor.find({ userId: req.params.userId });
|
||||||
// Map each monitor to include its associated checks
|
// Map each monitor to include its associated checks
|
||||||
const monitorsWithChecks = await Promise.all(
|
const monitorsWithChecks = await Promise.all(
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
const mongoose = require("mongoose");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mongoose schema for storing metrics from Google Lighthouse.
|
||||||
|
* @typedef {Object} PageSpeedCheck
|
||||||
|
* @property {mongoose.Schema.Types.ObjectId} monitorId - Reference to the Monitor model.
|
||||||
|
* @property {number} accessibility - Accessibility score.
|
||||||
|
* @property {number} bestPractices - Best practices score.
|
||||||
|
* @property {number} seo - SEO score.
|
||||||
|
* @property {number} performance - Performance score.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const PageSpeedCheck = mongoose.Schema(
|
||||||
|
{
|
||||||
|
monitorId: {
|
||||||
|
type: mongoose.Schema.Types.ObjectId,
|
||||||
|
ref: "Monitor",
|
||||||
|
immutable: true,
|
||||||
|
},
|
||||||
|
accessibility: {
|
||||||
|
type: Number,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
bestPractices: {
|
||||||
|
type: Number,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
seo: {
|
||||||
|
type: Number,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
performance: {
|
||||||
|
type: Number,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
timestamps: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mongoose model for storing metrics from Google Lighthouse.
|
||||||
|
* @typedef {mongoose.Model<PageSpeedCheck>} LighthouseMetricsModel
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = mongoose.model("PageSpeedCheck", PageSpeedCheck);
|
||||||
Reference in new issue
Block a user