docs: add comments for queries

pull/5193/head
Peace 2 months ago
parent ec2cebc5df
commit ac8d1d6346
No known key found for this signature in database
GPG Key ID: 0EF6B46E172B739F

@ -1607,6 +1607,7 @@ class Monitor extends BeanModel {
* @returns {Promise<Bean[]>} 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<number[]>} 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<boolean>} 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

Loading…
Cancel
Save