mirror of https://github.com/requarks/wiki
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
789 B
43 lines
789 B
7 years ago
|
|
||
7 years ago
|
/* global WIKI */
|
||
7 years ago
|
|
||
|
module.exports = {
|
||
|
Query: {
|
||
|
comments(obj, args, context, info) {
|
||
7 years ago
|
return WIKI.db.Comment.findAll({ where: args })
|
||
7 years ago
|
}
|
||
|
},
|
||
|
Mutation: {
|
||
|
createComment(obj, args) {
|
||
7 years ago
|
return WIKI.db.Comment.create({
|
||
7 years ago
|
content: args.content,
|
||
|
author: args.userId,
|
||
|
document: args.documentId
|
||
|
})
|
||
|
},
|
||
|
deleteComment(obj, args) {
|
||
7 years ago
|
return WIKI.db.Comment.destroy({
|
||
7 years ago
|
where: {
|
||
|
id: args.id
|
||
|
},
|
||
|
limit: 1
|
||
|
})
|
||
|
},
|
||
|
modifyComment(obj, args) {
|
||
7 years ago
|
return WIKI.db.Comment.update({
|
||
7 years ago
|
content: args.content
|
||
|
}, {
|
||
|
where: { id: args.id }
|
||
|
})
|
||
|
}
|
||
|
},
|
||
|
Comment: {
|
||
|
author(cm) {
|
||
|
return cm.getAuthor()
|
||
|
},
|
||
|
document(cm) {
|
||
|
return cm.getDocument()
|
||
|
}
|
||
|
}
|
||
|
}
|