cleaned up graph, standardised mutation

This commit is contained in:
Wyatt Johnson
2017-05-12 14:04:09 -06:00
parent ffd96f57e9
commit a5c9a8e4b0
2 changed files with 5 additions and 2 deletions
+3
View File
@@ -59,6 +59,7 @@ const createComment = async ({user, loaders: {Comments}, pubsub}, {body, asset_i
/**
* Filters the comment object and outputs wordlist results.
* @param {Object} context graphql context
* @param {String} body body of a comment
* @param {String} [asset_id] id of asset comment is posted on
* @return {Object} resolves to the wordlist results
@@ -78,6 +79,7 @@ const filterNewComment = (context, {body, asset_id}) => {
/**
* This resolves a given comment's status to take into account moderator actions
* are applied.
* @param {Object} context graphql context
* @param {String} body body of the comment
* @param {String} [asset_id] asset for the comment
* @param {Object} [wordlist={}] the results of the wordlist scan
@@ -172,6 +174,7 @@ const createPublicComment = async (context, commentInput) => {
/**
* Sets the status of a comment
* @param {Object} context graphql context
* @param {String} comment comment in graphql context
* @param {String} id identifier of the comment (uuid)
* @param {String} status the new status of the comment
+2 -2
View File
@@ -5,8 +5,8 @@ const RootMutation = {
createComment(_, {comment}, {mutators: {Comment}}) {
return wrapResponse('comment')(Comment.create(comment));
},
editComment(_, args, {mutators: {Comment}}) {
return wrapResponse('comment')(Comment.edit(args));
editComment(_, {id, asset_id, edit: {body}}, {mutators: {Comment}}) {
return wrapResponse('comment')(Comment.edit({id, asset_id, edit: {body}}));
},
createFlag(_, {flag: {item_id, item_type, reason, message}}, {mutators: {Action}}) {
return wrapResponse('flag')(Action.create({item_id, item_type, action_type: 'FLAG', group_id: reason, metadata: {message}}));