mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-08 22:44:24 +08:00
[status page] implement rest api for heartbeat
This commit is contained in:
@@ -4,17 +4,7 @@ const { R } = require("redbean-node");
|
||||
class Group extends BeanModel {
|
||||
|
||||
async toPublicJSON() {
|
||||
|
||||
let monitorBeanList = R.convertToBeans("monitor", await R.getAll(`
|
||||
SELECT * FROM monitor, monitor_group
|
||||
WHERE monitor.id = monitor_group.monitor_id
|
||||
AND group_id = ?
|
||||
`, [
|
||||
this.id,
|
||||
]));
|
||||
|
||||
console.log(monitorBeanList);
|
||||
|
||||
let monitorBeanList = await this.getMonitorList();
|
||||
let monitorList = [];
|
||||
|
||||
for (let bean of monitorBeanList) {
|
||||
@@ -28,6 +18,16 @@ class Group extends BeanModel {
|
||||
monitorList,
|
||||
};
|
||||
}
|
||||
|
||||
async getMonitorList() {
|
||||
return R.convertToBeans("monitor", await R.getAll(`
|
||||
SELECT monitor.* FROM monitor, monitor_group
|
||||
WHERE monitor.id = monitor_group.monitor_id
|
||||
AND group_id = ?
|
||||
`, [
|
||||
this.id,
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Group;
|
||||
|
Reference in New Issue
Block a user