feat: core improvements + local fs provider + UI fixes

This commit is contained in:
NGPixel
2018-07-29 22:23:33 -04:00
parent 803d86ff63
commit 2817c72ec3
65 changed files with 482 additions and 264 deletions

View File

@@ -6,16 +6,16 @@ const gql = require('graphql')
module.exports = {
Query: {
files(obj, args, context, info) {
return WIKI.db.File.findAll({ where: args })
return WIKI.models.File.findAll({ where: args })
}
},
Mutation: {
uploadFile(obj, args) {
// todo
return WIKI.db.File.create(args)
return WIKI.models.File.create(args)
},
deleteFile(obj, args) {
return WIKI.db.File.destroy({
return WIKI.models.File.destroy({
where: {
id: args.id
},
@@ -23,18 +23,18 @@ module.exports = {
})
},
renameFile(obj, args) {
return WIKI.db.File.update({
return WIKI.models.File.update({
filename: args.filename
}, {
where: { id: args.id }
})
},
moveFile(obj, args) {
return WIKI.db.File.findById(args.fileId).then(fl => {
return WIKI.models.File.findById(args.fileId).then(fl => {
if (!fl) {
throw new gql.GraphQLError('Invalid File ID')
}
return WIKI.db.Folder.findById(args.folderId).then(fld => {
return WIKI.models.Folder.findById(args.folderId).then(fld => {
if (!fld) {
throw new gql.GraphQLError('Invalid Folder ID')
}