Merge pull request #304 from bluewave-labs/feat/monitor-details-data

Feat/monitor details data
This commit is contained in:
Alexander Holliday authored and GitHub committed 2024-07-10 12:34:02 -07:00
commit 9277a37559
2 files changed
+46 -65

No files matched your search

+3 -1
View File
@@ -273,7 +273,9 @@ const getAllMonitors = async (req, res) => {
const getMonitorById = async (req, res) => {
try {
const monitor = await Monitor.findById(req.params.monitorId);
const checks = await Check.find({ monitorId: monitor._id });
const checks = await Check.find({ monitorId: monitor._id }).sort({
createdAt: -1,
});
const monitorWithChecks = { ...monitor.toObject(), checks };
return monitorWithChecks;
} catch (error) {