From 98d8598052813d2430dda472d8a5f1cd49890ece Mon Sep 17 00:00:00 2001 From: Gero Gerke Date: Tue, 10 Jan 2023 10:47:24 +0100 Subject: [PATCH] chore: add jsdocs for missing functions --- server/model/monitor.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index c130dce96..f773bba82 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -26,6 +26,10 @@ const { UptimeCacheList } = require("../uptime-cache-list"); */ class Monitor extends BeanModel { + /** + * Formats the status code to a human readable form + * @returns {string} a human readable string that corresponds to the status code + */ statusToKey(status) { switch (status) { case 0: return "down"; @@ -39,10 +43,10 @@ class Monitor extends BeanModel { /** * Return an object that ready to parse to JSON for public * Only show necessary data to public - * @param {boolean} [includeStatus = false] Should the JSON include the status + * @param {boolean} [showStatus = false] Should the JSON show the status * @returns {Object} */ - async toPublicJSON(showTags = false, includeStatus = false) { + async toPublicJSON(showTags = false, showStatus = false) { let obj = { id: this.id, name: this.name, @@ -58,7 +62,7 @@ class Monitor extends BeanModel { obj.tags = await this.getTags(); } - if (includeStatus) { + if (showStatus) { const heartbeat = await Monitor.getPreviousHeartbeat(this.id); obj.status = this.statusToKey(heartbeat.status); }