fix: JSON fields handling for MariaDB
This commit is contained in:
@@ -22,14 +22,15 @@ module.exports = class Authentication extends Model {
|
||||
properties: {
|
||||
key: {type: 'string'},
|
||||
isEnabled: {type: 'boolean'},
|
||||
config: {type: 'object'},
|
||||
selfRegistration: {type: 'boolean'},
|
||||
domainWhitelist: {type: 'object'},
|
||||
autoEnrollGroups: {type: 'object'}
|
||||
selfRegistration: {type: 'boolean'}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static get jsonAttributes() {
|
||||
return ['config', 'domainWhitelist', 'autoEnrollGroups']
|
||||
}
|
||||
|
||||
static async getStrategy(key) {
|
||||
return WIKI.models.authentication.query().findOne({ key })
|
||||
}
|
||||
|
@@ -21,12 +21,15 @@ module.exports = class Editor extends Model {
|
||||
|
||||
properties: {
|
||||
key: {type: 'string'},
|
||||
isEnabled: {type: 'boolean'},
|
||||
config: {type: 'object'}
|
||||
isEnabled: {type: 'boolean'}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static get jsonAttributes() {
|
||||
return ['config']
|
||||
}
|
||||
|
||||
static async getEditors() {
|
||||
return WIKI.models.editors.query()
|
||||
}
|
||||
|
@@ -20,6 +20,10 @@ module.exports = class Group extends Model {
|
||||
}
|
||||
}
|
||||
|
||||
static get jsonAttributes() {
|
||||
return ['permissions', 'pageRules']
|
||||
}
|
||||
|
||||
static get relationMappings() {
|
||||
return {
|
||||
users: {
|
||||
|
@@ -3,7 +3,7 @@ const Model = require('objection').Model
|
||||
/**
|
||||
* Locales model
|
||||
*/
|
||||
module.exports = class User extends Model {
|
||||
module.exports = class Locale extends Model {
|
||||
static get tableName() { return 'locales' }
|
||||
static get idColumn() { return 'code' }
|
||||
|
||||
@@ -14,7 +14,6 @@ module.exports = class User extends Model {
|
||||
|
||||
properties: {
|
||||
code: {type: 'string'},
|
||||
strings: {type: 'object'},
|
||||
isRTL: {type: 'boolean', default: false},
|
||||
name: {type: 'string'},
|
||||
nativeName: {type: 'string'},
|
||||
@@ -24,6 +23,10 @@ module.exports = class User extends Model {
|
||||
}
|
||||
}
|
||||
|
||||
static get jsonAttributes() {
|
||||
return ['strings']
|
||||
}
|
||||
|
||||
$beforeUpdate() {
|
||||
this.updatedAt = new Date().toISOString()
|
||||
}
|
||||
|
@@ -22,12 +22,15 @@ module.exports = class Logger extends Model {
|
||||
properties: {
|
||||
key: {type: 'string'},
|
||||
isEnabled: {type: 'boolean'},
|
||||
level: {type: 'string'},
|
||||
config: {type: 'object'}
|
||||
level: {type: 'string'}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static get jsonAttributes() {
|
||||
return ['config']
|
||||
}
|
||||
|
||||
static async getLoggers() {
|
||||
return WIKI.models.loggers.query()
|
||||
}
|
||||
|
@@ -22,12 +22,15 @@ module.exports = class Renderer extends Model {
|
||||
|
||||
properties: {
|
||||
key: {type: 'string'},
|
||||
isEnabled: {type: 'boolean'},
|
||||
config: {type: 'object'}
|
||||
isEnabled: {type: 'boolean'}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static get jsonAttributes() {
|
||||
return ['config']
|
||||
}
|
||||
|
||||
static async getRenderers() {
|
||||
return WIKI.models.renderers.query()
|
||||
}
|
||||
|
@@ -22,12 +22,15 @@ module.exports = class SearchEngine extends Model {
|
||||
properties: {
|
||||
key: {type: 'string'},
|
||||
isEnabled: {type: 'boolean'},
|
||||
level: {type: 'string'},
|
||||
config: {type: 'object'}
|
||||
level: {type: 'string'}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static get jsonAttributes() {
|
||||
return ['config']
|
||||
}
|
||||
|
||||
static async getSearchEngines() {
|
||||
return WIKI.models.searchEngines.query()
|
||||
}
|
||||
|
@@ -13,17 +13,20 @@ module.exports = class Setting extends Model {
|
||||
static get jsonSchema () {
|
||||
return {
|
||||
type: 'object',
|
||||
required: ['key', 'value'],
|
||||
required: ['key'],
|
||||
|
||||
properties: {
|
||||
key: {type: 'string'},
|
||||
value: {type: 'object'},
|
||||
createdAt: {type: 'string'},
|
||||
updatedAt: {type: 'string'}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static get jsonAttributes() {
|
||||
return ['value']
|
||||
}
|
||||
|
||||
$beforeUpdate() {
|
||||
this.updatedAt = new Date().toISOString()
|
||||
}
|
||||
|
@@ -24,12 +24,15 @@ module.exports = class Storage extends Model {
|
||||
properties: {
|
||||
key: {type: 'string'},
|
||||
isEnabled: {type: 'boolean'},
|
||||
mode: {type: 'string'},
|
||||
config: {type: 'object'}
|
||||
mode: {type: 'string'}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static get jsonAttributes() {
|
||||
return ['config']
|
||||
}
|
||||
|
||||
static async getTargets() {
|
||||
return WIKI.models.storage.query()
|
||||
}
|
||||
|
Reference in New Issue
Block a user