setting.js 474 B

123456789101112131415161718192021222324252627282930
  1. // Objection Docs:
  2. // http://vincit.github.io/objection.js/
  3. const db = require('../db');
  4. const Model = require('objection').Model;
  5. Model.knex(db);
  6. class Setting extends Model {
  7. $beforeInsert () {
  8. // Default for meta
  9. if (typeof this.meta === 'undefined') {
  10. this.meta = {};
  11. }
  12. }
  13. static get name () {
  14. return 'Setting';
  15. }
  16. static get tableName () {
  17. return 'setting';
  18. }
  19. static get jsonAttributes () {
  20. return ['meta'];
  21. }
  22. }
  23. module.exports = Setting;