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

@@ -12,22 +12,16 @@ module.exports = {
},
NavigationQuery: {
async tree(obj, args, context, info) {
// let renderers = await WIKI.models.renderers.getRenderers()
return []
return WIKI.models.navigation.getTree()
}
},
NavigationMutation: {
async updateTree(obj, args, context) {
try {
// for (let rdr of args.renderers) {
// await WIKI.models.storage.query().patch({
// isEnabled: rdr.isEnabled,
// config: _.reduce(rdr.config, (result, value, key) => {
// _.set(result, `${value.key}`, value.value)
// return result
// }, {})
// }).where('key', rdr.key)
// }
await WIKI.models.navigation.query().patch({
config: args.tree
}).where('key', 'site')
return {
responseResult: graphHelper.generateSuccess('Navigation updated successfully')
}