2016-11-07 11:47:33 +09:00
|
|
|
import Telescope, { newMutation, editMutation, removeMutation } from 'meteor/nova:lib';
|
2016-11-05 18:37:46 +09:00
|
|
|
import Comments from './collection.js'
|
|
|
|
import Users from 'meteor/nova:users';
|
|
|
|
import Events from "meteor/nova:events";
|
|
|
|
|
2016-11-07 11:47:33 +09:00
|
|
|
// Resolvers
|
2016-11-05 18:37:46 +09:00
|
|
|
Comments.mutations = {
|
|
|
|
|
2016-11-07 23:46:12 +09:00
|
|
|
commentsNew(root, {document}, context) {
|
2016-11-07 12:11:02 +09:00
|
|
|
return newMutation({
|
|
|
|
collection: context.Comments,
|
2016-11-07 23:46:12 +09:00
|
|
|
document: document,
|
2016-11-07 12:11:02 +09:00
|
|
|
currentUser: context.currentUser,
|
|
|
|
validate: true
|
|
|
|
});
|
2016-11-05 18:37:46 +09:00
|
|
|
},
|
|
|
|
|
2016-11-07 23:46:12 +09:00
|
|
|
commentsEdit(root, {documentId, set, unset}, context) {
|
2016-11-07 12:11:02 +09:00
|
|
|
return editMutation({
|
|
|
|
collection: context.Comments,
|
2016-11-07 23:46:12 +09:00
|
|
|
documentId: documentId,
|
2016-11-07 12:11:02 +09:00
|
|
|
set: set,
|
|
|
|
unset: unset,
|
|
|
|
currentUser: context.currentUser,
|
|
|
|
validate: true
|
|
|
|
});
|
2016-11-07 11:47:33 +09:00
|
|
|
},
|
2016-11-05 18:37:46 +09:00
|
|
|
|
2016-11-07 23:46:12 +09:00
|
|
|
commentsRemove(root, {documentId}, context) {
|
2016-11-07 12:11:02 +09:00
|
|
|
return removeMutation({
|
|
|
|
collection: context.Comments,
|
2016-11-07 23:46:12 +09:00
|
|
|
documentId: documentId,
|
2016-11-07 12:11:02 +09:00
|
|
|
currentUser: context.currentUser,
|
|
|
|
validate: true
|
|
|
|
});
|
2016-11-05 18:37:46 +09:00
|
|
|
},
|
|
|
|
|
2016-11-07 23:46:12 +09:00
|
|
|
commentsVote(root, {documentId, voteType}, context) {
|
2016-11-05 18:37:46 +09:00
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-11-07 11:47:33 +09:00
|
|
|
// GraphQL mutations
|
2016-11-07 23:46:12 +09:00
|
|
|
Telescope.graphQL.addMutation('commentsNew(document: commentsInput) : Comment');
|
|
|
|
Telescope.graphQL.addMutation('commentsEdit(documentId: String, set: commentsInput, unset: commentsUnset) : Comment');
|
|
|
|
Telescope.graphQL.addMutation('commentsRemove(documentId: String) : Comment');
|
|
|
|
Telescope.graphQL.addMutation('commentsVote(documentId: String, voteType: String) : Comment');
|
2016-11-07 11:47:33 +09:00
|
|
|
|
2016-11-05 18:37:46 +09:00
|
|
|
export default Comments.mutations;
|