Return all actions in CreateCommentResponse

This commit is contained in:
Chi Vinh Le
2017-09-20 04:17:15 +07:00
parent 5f7c4f82e7
commit 42954fb84a
5 changed files with 20 additions and 18 deletions
+2 -3
View File
@@ -2,11 +2,10 @@ const RootMutation = {
createComment: async (_, {input}, {mutators: {Comment}, loaders: {Actions}}) => {
const comment = await Comment.create(input);
// Retrieve flags that was assigned to comment.
// Retrieve actions that was assigned to comment.
const actions = await Actions.getByID.load(comment.id);
const flags = actions.filter(({action_type}) => action_type === 'FLAG');
return {comment, flags};
return {comment, actions};
},
editComment: async (_, {id, asset_id, edit: {body}}, {mutators: {Comment}}) => ({
comment: await Comment.edit({id, asset_id, edit: {body}}),
+3 -3
View File
@@ -261,7 +261,7 @@ enum ACTION_TYPE {
# CommentsQuery allows the ability to query comments by a specific methods.
input CommentsQuery {
# Author of the comments
# Author of the commente
author_id: ID
# Current status of a comment.
@@ -877,8 +877,8 @@ type CreateCommentResponse implements Response {
# The comment that was created.
comment: Comment
# Flags that was assigned during creation of the comment.
flags: [FlagAction]
# Actions that was assigned during creation of the comment.
actions: [Action]
# An array of errors relating to the mutation that occurred.
errors: [UserError!]