mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-03-11 03:44:46 +00:00
refactor: make getAllChildrenIDs more compact
This commit is contained in:
parent
c079971a7b
commit
5dc66e1495
1 changed files with 1 additions and 3 deletions
|
@ -1689,7 +1689,7 @@ class Monitor extends BeanModel {
|
||||||
* @returns {Promise<number[]>} IDs of all children
|
* @returns {Promise<number[]>} IDs of all children
|
||||||
*/
|
*/
|
||||||
static async getAllChildrenIDs(monitorID) {
|
static async getAllChildrenIDs(monitorID) {
|
||||||
const children = await R.getAll(`
|
return await R.getCol(`
|
||||||
WITH RECURSIVE MonitorHierarchy(id) AS (
|
WITH RECURSIVE MonitorHierarchy(id) AS (
|
||||||
SELECT id FROM monitor WHERE id = ?
|
SELECT id FROM monitor WHERE id = ?
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
@ -1700,8 +1700,6 @@ class Monitor extends BeanModel {
|
||||||
monitorID,
|
monitorID,
|
||||||
monitorID
|
monitorID
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return children.map((child) => child.id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue