From 5dc66e1495c1becabe364eb96fee72c7ef645fee Mon Sep 17 00:00:00 2001 From: Peace Date: Thu, 17 Oct 2024 00:05:55 +0200 Subject: [PATCH] refactor: make getAllChildrenIDs more compact --- server/model/monitor.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index e5580a2e8..b51056643 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -1689,7 +1689,7 @@ class Monitor extends BeanModel { * @returns {Promise} IDs of all children */ static async getAllChildrenIDs(monitorID) { - const children = await R.getAll(` + return await R.getCol(` WITH RECURSIVE MonitorHierarchy(id) AS ( SELECT id FROM monitor WHERE id = ? UNION ALL @@ -1700,8 +1700,6 @@ class Monitor extends BeanModel { monitorID, monitorID ]); - - return children.map((child) => child.id); } /**