fix: setup issues + webpack improvements
This commit is contained in:
@@ -32,6 +32,7 @@ module.exports = class Editor extends Model {
|
||||
}
|
||||
|
||||
static async refreshEditorsFromDisk() {
|
||||
let trx
|
||||
try {
|
||||
const dbEditors = await WIKI.models.editors.query()
|
||||
|
||||
@@ -72,7 +73,11 @@ module.exports = class Editor extends Model {
|
||||
}
|
||||
}
|
||||
if (newEditors.length > 0) {
|
||||
await WIKI.models.editors.query().insert(newEditors)
|
||||
trx = await WIKI.models.Objection.transaction.start(WIKI.models.knex)
|
||||
for (let editor of newEditors) {
|
||||
await WIKI.models.editors.query(trx).insert(editor)
|
||||
}
|
||||
await trx.commit()
|
||||
WIKI.logger.info(`Loaded ${newEditors.length} new editors: [ OK ]`)
|
||||
} else {
|
||||
WIKI.logger.info(`No new editors found: [ SKIPPED ]`)
|
||||
|
27
server/models/navigation.js
Normal file
27
server/models/navigation.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const Model = require('objection').Model
|
||||
|
||||
/* global WIKI */
|
||||
|
||||
/**
|
||||
* Navigation model
|
||||
*/
|
||||
module.exports = class Navigation extends Model {
|
||||
static get tableName() { return 'navigation' }
|
||||
static get idColumn() { return 'key' }
|
||||
|
||||
static get jsonSchema () {
|
||||
return {
|
||||
type: 'object',
|
||||
required: ['key'],
|
||||
|
||||
properties: {
|
||||
key: {type: 'string'},
|
||||
config: {type: 'object'}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static async getTree() {
|
||||
return WIKI.models.navigation.query()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user