2017-12-14 20:12:14 +02:00
|
|
|
const BaseModel = require('lib/BaseModel.js');
|
|
|
|
const BaseItem = require('lib/models/BaseItem.js');
|
2017-12-12 20:41:02 +02:00
|
|
|
|
|
|
|
class MasterKey extends BaseItem {
|
|
|
|
|
|
|
|
static tableName() {
|
|
|
|
return 'master_keys';
|
|
|
|
}
|
|
|
|
|
|
|
|
static modelType() {
|
|
|
|
return BaseModel.TYPE_MASTER_KEY;
|
|
|
|
}
|
|
|
|
|
2017-12-13 20:57:40 +02:00
|
|
|
static encryptionSupported() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-12-14 21:39:13 +02:00
|
|
|
static latest() {
|
|
|
|
return this.modelSelectOne('SELECT * FROM master_keys WHERE created_time >= (SELECT max(created_time) FROM master_keys)');
|
|
|
|
}
|
|
|
|
|
|
|
|
static async save(o, options = null) {
|
|
|
|
return super.save(o, options).then((item) => {
|
|
|
|
this.dispatch({
|
|
|
|
type: 'MASTERKEY_UPDATE_ONE',
|
|
|
|
item: item,
|
|
|
|
});
|
|
|
|
return item;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-12-12 20:41:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = MasterKey;
|