refactoring

This commit is contained in:
Alex Holliday committed 2026-01-12 22:58:46 +00:00
1 parent e090d3cfd3
commit 7a6b0d5da4
19 files changed
+699 -116

No files matched your search

+13 -8
View File
@@ -4,7 +4,7 @@ const buildUptimeDetailsPipeline = (monitorId, dates, dateString) => {
return [
{
$match: {
monitorId: new ObjectId(monitorId),
"metadata.monitorId": new ObjectId(monitorId),
updatedAt: { $gte: dates.start, $lte: dates.end },
},
},
@@ -172,8 +172,8 @@ const buildHardwareDetailsPipeline = (monitor, dates, dateString) => {
return [
{
$match: {
monitorId: monitor._id,
type: "hardware",
"metadata.monitorId": monitor._id,
"metadata.type": "hardware",
createdAt: { $gte: dates.start, $lte: dates.end },
},
},
@@ -233,11 +233,16 @@ const buildHardwareDetailsPipeline = (monitor, dates, dateString) => {
},
pipeline: [
{
$match: {
$expr: {
$and: [{ $eq: ["$monitorId", monitor._id] }, { $gte: ["$createdAt", dates.start] }, { $lte: ["$createdAt", dates.end] }],
},
},
$match: {
$expr: {
$and: [
{ $eq: ["$metadata.monitorId", monitor._id] },
{ $eq: ["$metadata.type", "hardware"] },
{ $gte: ["$createdAt", dates.start] },
{ $lte: ["$createdAt", dates.end] },
],
},
},
},
{
$group: {