uptime-kuma/server/model/maintenance.js

37 lines
914 B
JavaScript
Raw Normal View History

const dayjs = require("dayjs");
const utc = require("dayjs/plugin/utc");
let timezone = require("dayjs/plugin/timezone");
dayjs.extend(utc);
dayjs.extend(timezone);
const { BeanModel } = require("redbean-node/dist/bean-model");
class Maintenance extends BeanModel {
/**
2022-04-30 16:50:05 +03:00
* Return an object that ready to parse to JSON for public
* Only show necessary data to public
2022-04-30 16:50:05 +03:00
* @returns {Object}
*/
async toPublicJSON() {
return {
id: this.id,
title: this.title,
description: this.description,
start_date: this.start_date,
end_date: this.end_date,
2022-09-23 21:33:29 +03:00
strategy: this.strategy,
active: !!this.active,
};
}
/**
2022-04-30 16:50:05 +03:00
* Return an object that ready to parse to JSON
* @returns {Object}
*/
async toJSON() {
2022-09-23 21:33:29 +03:00
return this.toPublicJSON();
}
}
module.exports = Maintenance;