Add JSDoc to server/model/*

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
This commit is contained in:
Matthew Nickson
2022-04-16 21:11:45 +01:00
parent 5a209c74e1
commit 45f44b183d
5 changed files with 96 additions and 6 deletions

View File

@@ -3,6 +3,11 @@ const { R } = require("redbean-node");
class Group extends BeanModel {
/**
* Return a object that ready to parse to JSON for public
* Only show necessary data to public
* @returns {Object}
*/
async toPublicJSON() {
let monitorBeanList = await this.getMonitorList();
let monitorList = [];
@@ -19,6 +24,10 @@ class Group extends BeanModel {
};
}
/**
* Get all monitors
* @returns {Array<Bean>}
*/
async getMonitorList() {
return R.convertToBeans("monitor", await R.getAll(`
SELECT monitor.* FROM monitor, monitor_group