mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-01-15 06:09:44 -06:00
add array of all monitors to response for search
This commit is contained in:
@@ -545,6 +545,15 @@ const getMonitorsByTeamId = async (req) => {
|
||||
},
|
||||
],
|
||||
monitors: [
|
||||
{ $sort: sort },
|
||||
{
|
||||
$project: {
|
||||
_id: 1,
|
||||
name: 1,
|
||||
},
|
||||
},
|
||||
],
|
||||
filteredMonitors: [
|
||||
...(filter !== undefined
|
||||
? [
|
||||
{
|
||||
@@ -657,20 +666,21 @@ const getMonitorsByTeamId = async (req) => {
|
||||
{
|
||||
$project: {
|
||||
summary: { $arrayElemAt: ["$summary", 0] },
|
||||
filteredMonitors: 1,
|
||||
monitors: 1,
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
let { monitors, summary } = results[0];
|
||||
monitors = monitors.map((monitor) => {
|
||||
let { monitors, filteredMonitors, summary } = results[0];
|
||||
filteredMonitors = filteredMonitors.map((monitor) => {
|
||||
if (!monitor.checks) {
|
||||
return monitor;
|
||||
}
|
||||
monitor.checks = NormalizeData(monitor.checks, 10, 100);
|
||||
return monitor;
|
||||
});
|
||||
return { monitors, summary };
|
||||
return { monitors, filteredMonitors, summary };
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user