You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
786 B

  1. const Model = require('objection').Model
  2. /**
  3. * Locales model
  4. */
  5. module.exports = class User extends Model {
  6. static get tableName() { return 'locales' }
  7. static get idColumn() { return 'code' }
  8. static get jsonSchema () {
  9. return {
  10. type: 'object',
  11. required: ['code', 'name'],
  12. properties: {
  13. code: {type: 'string'},
  14. strings: {type: 'object'},
  15. isRTL: {type: 'boolean', default: false},
  16. name: {type: 'string'},
  17. nativeName: {type: 'string'},
  18. createdAt: {type: 'string'},
  19. updatedAt: {type: 'string'}
  20. }
  21. }
  22. }
  23. $beforeUpdate() {
  24. this.updatedAt = new Date().toISOString()
  25. }
  26. $beforeInsert() {
  27. this.createdAt = new Date().toISOString()
  28. this.updatedAt = new Date().toISOString()
  29. }
  30. }