2017-08-14 00:33:06 +00:00
|
|
|
|
2018-03-05 20:49:36 +00:00
|
|
|
/* global WIKI */
|
2017-08-14 00:33:06 +00:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
Query: {
|
|
|
|
folders(obj, args, context, info) {
|
2018-03-05 20:49:36 +00:00
|
|
|
return WIKI.db.Folder.findAll({ where: args })
|
2017-08-14 00:33:06 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
Mutation: {
|
|
|
|
createFolder(obj, args) {
|
2018-03-05 20:49:36 +00:00
|
|
|
return WIKI.db.Folder.create(args)
|
2017-08-14 00:33:06 +00:00
|
|
|
},
|
2018-03-19 03:12:56 +00:00
|
|
|
deleteFolder(obj, args) {
|
2018-03-05 20:49:36 +00:00
|
|
|
return WIKI.db.Folder.destroy({
|
2017-08-14 00:33:06 +00:00
|
|
|
where: {
|
|
|
|
id: args.id
|
|
|
|
},
|
|
|
|
limit: 1
|
|
|
|
})
|
2017-08-20 02:51:25 +00:00
|
|
|
},
|
|
|
|
renameFolder(obj, args) {
|
2018-03-05 20:49:36 +00:00
|
|
|
return WIKI.db.Folder.update({
|
2017-08-20 02:51:25 +00:00
|
|
|
name: args.name
|
|
|
|
}, {
|
|
|
|
where: { id: args.id }
|
|
|
|
})
|
2017-08-14 00:33:06 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
Folder: {
|
|
|
|
files(grp) {
|
|
|
|
return grp.getFiles()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|