feat: add search functionality to infrastructure moniter

This commit is contained in:
Amol committed 2025-06-14 16:16:49 +05:30
1 parent 275f2384c0
commit 7189c19d55
9 files changed
+158 -21

No files matched your search

+4 -1
View File
@@ -510,7 +510,7 @@ const getMonitorById = async (monitorId) => {
};
const getMonitorsByTeamId = async (req) => {
let { limit, type, page, rowsPerPage, filter, field, order } = req.query;
let { limit, type, page, rowsPerPage, filter, field, order, search } = req.query;
limit = parseInt(limit);
page = parseInt(page);
rowsPerPage = parseInt(rowsPerPage);
@@ -523,6 +523,9 @@ const getMonitorsByTeamId = async (req) => {
if (type !== undefined) {
matchStage.type = Array.isArray(type) ? { $in: type } : type;
}
if (search) {
matchStage.name = { $regex: search, $options: "i" };
}
const summaryResult = await Monitor.aggregate(
buildMonitorSummaryByTeamIdPipeline({ matchStage })