mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 23:04:04 +00:00
docs: add comments for queries
This commit is contained in:
parent
ec2cebc5df
commit
ac8d1d6346
1 changed files with 3 additions and 0 deletions
|
@ -1607,6 +1607,7 @@ class Monitor extends BeanModel {
|
||||||
* @returns {Promise<Bean[]>} Active Monitors
|
* @returns {Promise<Bean[]>} Active Monitors
|
||||||
*/
|
*/
|
||||||
static async getAllActiveMonitors() {
|
static async getAllActiveMonitors() {
|
||||||
|
// Gets all monitors but only if they and all their ancestors are active
|
||||||
return R.convertToBeans("monitor", await R.getAll(`
|
return R.convertToBeans("monitor", await R.getAll(`
|
||||||
WITH RECURSIVE MonitorHierarchy AS (
|
WITH RECURSIVE MonitorHierarchy AS (
|
||||||
SELECT * FROM monitor
|
SELECT * FROM monitor
|
||||||
|
@ -1683,6 +1684,7 @@ class Monitor extends BeanModel {
|
||||||
* @returns {Promise<number[]>} IDs of all ancestors
|
* @returns {Promise<number[]>} IDs of all ancestors
|
||||||
*/
|
*/
|
||||||
static async getAllAncestorIDs(monitorID) {
|
static async getAllAncestorIDs(monitorID) {
|
||||||
|
// Gets all ancestor monitor ids recursive
|
||||||
return await R.getCol(`
|
return await R.getCol(`
|
||||||
WITH RECURSIVE Ancestors AS (
|
WITH RECURSIVE Ancestors AS (
|
||||||
SELECT parent FROM monitor
|
SELECT parent FROM monitor
|
||||||
|
@ -1754,6 +1756,7 @@ class Monitor extends BeanModel {
|
||||||
* @returns {Promise<boolean>} Is the parent monitor active?
|
* @returns {Promise<boolean>} Is the parent monitor active?
|
||||||
*/
|
*/
|
||||||
static async isParentActive(monitorID) {
|
static async isParentActive(monitorID) {
|
||||||
|
// Checks recursive if the parent and all its ancestors are active
|
||||||
const result = await R.getRow(`
|
const result = await R.getRow(`
|
||||||
WITH RECURSIVE MonitorHierarchy AS (
|
WITH RECURSIVE MonitorHierarchy AS (
|
||||||
SELECT parent FROM monitor
|
SELECT parent FROM monitor
|
||||||
|
|
Loading…
Reference in a new issue