diff options
Diffstat (limited to 'server/model/incident.js')
-rw-r--r-- | server/model/incident.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/server/model/incident.js b/server/model/incident.js new file mode 100644 index 0000000..c47dabb --- /dev/null +++ b/server/model/incident.js @@ -0,0 +1,23 @@ +const { BeanModel } = require("redbean-node/dist/bean-model"); + +class Incident extends BeanModel { + + /** + * Return an object that ready to parse to JSON for public + * Only show necessary data to public + * @returns {object} Object ready to parse + */ + toPublicJSON() { + return { + id: this.id, + style: this.style, + title: this.title, + content: this.content, + pin: this.pin, + createdDate: this.createdDate, + lastUpdatedDate: this.lastUpdatedDate, + }; + } +} + +module.exports = Incident; |