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.
32 lines
654 B
32 lines
654 B
7 years ago
|
const Model = require('objection').Model
|
||
|
|
||
|
/**
|
||
|
* Settings model
|
||
|
*/
|
||
|
module.exports = class User extends Model {
|
||
|
static get tableName() { return 'settings' }
|
||
|
|
||
|
static get jsonSchema () {
|
||
|
return {
|
||
|
type: 'object',
|
||
|
required: ['key', 'value'],
|
||
|
|
||
|
properties: {
|
||
|
id: {type: 'integer'},
|
||
|
key: {type: 'string'},
|
||
|
value: {type: 'object'},
|
||
|
createdAt: {type: 'string'},
|
||
|
updatedAt: {type: 'string'}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$beforeUpdate() {
|
||
|
this.updatedAt = new Date().toISOString()
|
||
|
}
|
||
|
$beforeInsert() {
|
||
|
this.createdAt = new Date().toISOString()
|
||
|
this.updatedAt = new Date().toISOString()
|
||
|
}
|
||
|
}
|