Merge pull request #304 from bluewave-labs/feat/monitor-details-data
Feat/monitor details data
This commit is contained in:
2 files changed
+46
-65
No files matched your search
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user