feat: navigation save / load

This commit is contained in:
Nicolas Giard
2018-10-21 22:25:17 -04:00
parent b870a4724d
commit b26f30ae20
4 changed files with 54 additions and 17 deletions

View File

@@ -16,12 +16,18 @@ module.exports = class Navigation extends Model {
properties: {
key: {type: 'string'},
config: {type: 'object'}
config: {type: 'array', items: {type: 'object'}}
}
}
}
static async getTree() {
return WIKI.models.navigation.query()
const navTree = await WIKI.models.navigation.query().findOne('key', 'site')
if (navTree) {
return navTree.config
} else {
WIKI.logger.warn('Site Navigation is missing or corrupted.')
return []
}
}
}