remove monitors from status page on delete

This commit is contained in:
Alex Holliday committed 2025-06-13 14:54:59 +08:00
1 parent cc8949538f
commit 4b621a228f
10 files changed
+47 -9

No files matched your search

+15 -4
View File
@@ -106,7 +106,10 @@ const getStatusPage = async (url) => {
},
},
{
$unwind: "$monitors",
$unwind: {
path: "$monitors",
preserveNullAndEmptyArrays: true,
},
},
{
$lookup: {
@@ -153,9 +156,17 @@ const getStatusPage = async (url) => {
url: 1,
},
monitors: {
$sortArray: {
input: "$monitors",
sortBy: { orderIndex: 1 },
$filter: {
input: {
$sortArray: {
input: "$monitors",
sortBy: { orderIndex: 1 },
},
},
as: "monitor",
cond: {
$ne: ["$$monitor.orderIndex", -1],
},
},
},
},