mirror of https://github.com/requarks/wiki
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.
35 lines
775 B
35 lines
775 B
const Model = require('objection').Model
|
|
|
|
/**
|
|
* Locales model
|
|
*/
|
|
module.exports = class User extends Model {
|
|
static get tableName() { return 'locales' }
|
|
|
|
static get jsonSchema () {
|
|
return {
|
|
type: 'object',
|
|
required: ['code', 'name'],
|
|
|
|
properties: {
|
|
id: {type: 'integer'},
|
|
code: {type: 'string'},
|
|
strings: {type: 'object'},
|
|
isRTL: {type: 'boolean', default: false},
|
|
name: {type: 'string'},
|
|
nativeName: {type: 'string'},
|
|
createdAt: {type: 'string'},
|
|
updatedAt: {type: 'string'}
|
|
}
|
|
}
|
|
}
|
|
|
|
$beforeUpdate() {
|
|
this.updatedAt = new Date().toISOString()
|
|
}
|
|
$beforeInsert() {
|
|
this.createdAt = new Date().toISOString()
|
|
this.updatedAt = new Date().toISOString()
|
|
}
|
|
}
|