feat: sidebar item permissions + admin nav edit

This commit is contained in:
NGPixel
2020-04-18 18:25:16 -04:00
committed by Nicolas Giard
parent 9a93ac28f2
commit 8aba5305d8
14 changed files with 287 additions and 252 deletions

View File

@@ -11,7 +11,7 @@ module.exports = {
},
NavigationQuery: {
async tree (obj, args, context, info) {
return WIKI.models.navigation.getTree({ cache: false, locale: 'all' })
return WIKI.models.navigation.getTree({ cache: false, locale: 'all', bypassAuth: true })
},
config (obj, args, context, info) {
return WIKI.config.nav
@@ -23,7 +23,9 @@ module.exports = {
await WIKI.models.navigation.query().patch({
config: args.tree
}).where('key', 'site')
await WIKI.cache.set('nav:sidebar', args.tree, 300)
for (const tree of args.tree) {
await WIKI.cache.set(`nav:sidebar:${tree.locale}`, tree.items, 300)
}
return {
responseResult: graphHelper.generateSuccess('Navigation updated successfully')