From ac8d1d6346730cd4461b40e238db850c6266b678 Mon Sep 17 00:00:00 2001 From: Peace Date: Thu, 17 Oct 2024 17:16:29 +0200 Subject: [PATCH] docs: add comments for queries --- server/model/monitor.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/model/monitor.js b/server/model/monitor.js index 0149e11f..c653590f 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -1607,6 +1607,7 @@ class Monitor extends BeanModel { * @returns {Promise} Active Monitors */ static async getAllActiveMonitors() { + // Gets all monitors but only if they and all their ancestors are active return R.convertToBeans("monitor", await R.getAll(` WITH RECURSIVE MonitorHierarchy AS ( SELECT * FROM monitor @@ -1683,6 +1684,7 @@ class Monitor extends BeanModel { * @returns {Promise} IDs of all ancestors */ static async getAllAncestorIDs(monitorID) { + // Gets all ancestor monitor ids recursive return await R.getCol(` WITH RECURSIVE Ancestors AS ( SELECT parent FROM monitor @@ -1754,6 +1756,7 @@ class Monitor extends BeanModel { * @returns {Promise} Is the parent monitor active? */ static async isParentActive(monitorID) { + // Checks recursive if the parent and all its ancestors are active const result = await R.getRow(` WITH RECURSIVE MonitorHierarchy AS ( SELECT parent FROM monitor