feat: navigation, editor improvements + graphql refactor

This commit is contained in:
NGPixel
2018-03-18 23:12:56 -04:00
parent 8462e18fc5
commit 3f0adc5daf
20 changed files with 284 additions and 400 deletions

View File

@@ -11,7 +11,7 @@ module.exports = {
createFolder(obj, args) {
return WIKI.db.Folder.create(args)
},
deleteGroup(obj, args) {
deleteFolder(obj, args) {
return WIKI.db.Folder.destroy({
where: {
id: args.id

View File

@@ -5,12 +5,18 @@ const gql = require('graphql')
module.exports = {
Query: {
groups(obj, args, context, info) {
async groups() { return {} }
},
Mutation: {
async groups() { return {} }
},
GroupQuery: {
list(obj, args, context, info) {
return WIKI.db.Group.findAll({ where: args })
}
},
Mutation: {
assignUserToGroup(obj, args) {
GroupMutation: {
assignUser(obj, args) {
return WIKI.db.Group.findById(args.groupId).then(grp => {
if (!grp) {
throw new gql.GraphQLError('Invalid Group ID')
@@ -23,10 +29,10 @@ module.exports = {
})
})
},
createGroup(obj, args) {
create(obj, args) {
return WIKI.db.Group.create(args)
},
deleteGroup(obj, args) {
delete(obj, args) {
return WIKI.db.Group.destroy({
where: {
id: args.id
@@ -34,7 +40,7 @@ module.exports = {
limit: 1
})
},
removeUserFromGroup(obj, args) {
unassignUser(obj, args) {
return WIKI.db.Group.findById(args.groupId).then(grp => {
if (!grp) {
throw new gql.GraphQLError('Invalid Group ID')
@@ -47,7 +53,7 @@ module.exports = {
})
})
},
renameGroup(obj, args) {
update(obj, args) {
return WIKI.db.Group.update({
name: args.name
}, {