12345678910111213141516171819202122232425262728293031323334353637 |
- const Model = require('objection').Model
- /**
- * Locales model
- */
- module.exports = class Locale extends Model {
- static get tableName() { return 'locales' }
- static get idColumn() { return 'code' }
- static get jsonSchema () {
- return {
- type: 'object',
- required: ['code', 'name'],
- properties: {
- code: {type: 'string'},
- isRTL: {type: 'boolean', default: false},
- name: {type: 'string'},
- nativeName: {type: 'string'},
- createdAt: {type: 'string'},
- updatedAt: {type: 'string'}
- }
- }
- }
- static get jsonAttributes() {
- return ['strings']
- }
- $beforeUpdate() {
- this.updatedAt = new Date().toISOString()
- }
- $beforeInsert() {
- this.createdAt = new Date().toISOString()
- this.updatedAt = new Date().toISOString()
- }
- }
|