mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-28 06:08:02 +03:00
Added JSDoc
This commit is contained in:
parent
57368c8c6c
commit
b4ffcc5555
4 changed files with 15 additions and 3 deletions
|
@ -8,8 +8,9 @@ const { BeanModel } = require("redbean-node/dist/bean-model");
|
|||
class Maintenance extends BeanModel {
|
||||
|
||||
/**
|
||||
* Return a object that ready to parse to JSON for public
|
||||
* Return an object that ready to parse to JSON for public
|
||||
* Only show necessary data to public
|
||||
* @returns {Object}
|
||||
*/
|
||||
async toPublicJSON() {
|
||||
return {
|
||||
|
@ -22,7 +23,8 @@ class Maintenance extends BeanModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return a object that ready to parse to JSON
|
||||
* Return an object that ready to parse to JSON
|
||||
* @returns {Object}
|
||||
*/
|
||||
async toJSON() {
|
||||
return {
|
||||
|
|
|
@ -947,6 +947,11 @@ class Monitor extends BeanModel {
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if monitor is under maintenance
|
||||
* @param {number} monitorID ID of monitor to check
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
static async isUnderMaintenance(monitorID) {
|
||||
const maintenance = await R.getRow("SELECT COUNT(*) AS count FROM monitor_maintenance mm JOIN maintenance ON mm.maintenance_id = maintenance.id WHERE mm.monitor_id = ? AND datetime(maintenance.start_date) <= datetime('now') AND datetime(maintenance.end_date) >= datetime('now') LIMIT 1", [ monitorID ]);
|
||||
return maintenance.count !== 0;
|
||||
|
|
|
@ -156,7 +156,7 @@ router.get("/api/status-page/:slug", cache("5 minutes"), async (request, respons
|
|||
}
|
||||
|
||||
});
|
||||
// TODO: make slug aware
|
||||
|
||||
// Status Page - Maintenance List
|
||||
async function getMaintenanceList() {
|
||||
try {
|
||||
|
|
|
@ -1740,6 +1740,11 @@ async function afterLogin(socket, user) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of maintenances for the given user.
|
||||
* @param {string} userID - The ID of the user to get maintenances for.
|
||||
* @returns {Promise<Object>} A promise that resolves to an object with maintenance IDs as keys and maintenances objects as values.
|
||||
*/
|
||||
async function getMaintenanceJSONList(userID) {
|
||||
let result = {};
|
||||
|
||||
|
|
Loading…
Reference in a new issue