add getmonitorsbyids

This commit is contained in:
Alex Holliday committed 2025-07-21 12:27:43 -07:00
1 parent 5dbec377e5
commit 87f843df1c
2 files changed
+66 -6

No files matched your search

+12
View File
@@ -461,6 +461,17 @@ const getMonitorById = async (monitorId) => {
}
};
const getMonitorsByIds = async (monitorIds) => {
try {
const objectIds = monitorIds.map((id) => new ObjectId(id));
return await Monitor.find({ _id: { $in: objectIds } }, { _id: 1, teamId: 1 }).lean();
} catch (error) {
error.service = SERVICE_NAME;
error.method = "getMonitorsByIds";
throw error;
}
};
const getMonitorsByTeamId = async ({ limit, type, page, rowsPerPage, filter, field, order, teamId }) => {
limit = parseInt(limit);
page = parseInt(page);
@@ -753,6 +764,7 @@ export {
getAllMonitorsWithUptimeStats,
getMonitorStatsById,
getMonitorById,
getMonitorsByIds,
getMonitorsByTeamId,
getMonitorsAndSummaryByTeamId,
getMonitorsWithChecksByTeamId,