2022-01-23 16:22:00 +02:00
|
|
|
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 15:50:05 +02:00
|
|
|
* Return an object that ready to parse to JSON for public
|
2022-01-23 16:22:00 +02:00
|
|
|
* Only show necessary data to public
|
2022-04-30 15:50:05 +02:00
|
|
|
* @returns {Object}
|
2022-01-23 16:22:00 +02:00
|
|
|
*/
|
|
|
|
async toPublicJSON() {
|
|
|
|
return {
|
|
|
|
id: this.id,
|
|
|
|
title: this.title,
|
|
|
|
description: this.description,
|
|
|
|
start_date: this.start_date,
|
2022-01-23 21:33:39 +02:00
|
|
|
end_date: this.end_date,
|
2022-01-23 16:22:00 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-04-30 15:50:05 +02:00
|
|
|
* Return an object that ready to parse to JSON
|
|
|
|
* @returns {Object}
|
2022-01-23 16:22:00 +02:00
|
|
|
*/
|
|
|
|
async toJSON() {
|
|
|
|
return {
|
|
|
|
id: this.id,
|
|
|
|
title: this.title,
|
|
|
|
description: this.description,
|
|
|
|
start_date: this.start_date,
|
2022-01-23 21:33:39 +02:00
|
|
|
end_date: this.end_date,
|
2022-01-23 16:22:00 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Maintenance;
|