Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add conversation part controller #1299

Merged
merged 1 commit into from
Dec 15, 2017

Conversation

joshsmith
Copy link
Contributor

@joshsmith joshsmith commented Dec 15, 2017

What's in this PR?

  • implement create_changeset
  • test create_changeset
  • implement Policy.ConversationPart.create?
  • write tests for Policy.ConversationPart.create?
  • implement Messages.create_conversation_part(params)
    • probably delegates to Messages.ConversationPart.create
    • uses create_changeset
  • test Messages.create_conversation_part(params)
    • if create_changeset is private, make sure to test casting behavior to
  • implement ConversationPartController :create endpoint
    • authorizes using policy
    • creates record using Messages.create_conversation_part
  • write tests for :create endpoint
  • implement Policy.ConversationPart.show?
  • write tests for Policy.ConversationPart.show?
  • implement ConversationPartController :show endpoint
    • fetches by id
    • authorizes using policy
  • write tests for :show endpoint
  • Implement Policy.ConversationPart.scope/2
    • scopes to ConversationPart records belonging to Conversation records defined by Policy.Conversation.scope/2
  • add tests for Policy.ConversationPart.scope
  • Implement :index endpoint
    • needs to support coalesced id filter - we will be fetching conversation.conversationParts in the client
    • might need to support filtering by conversation_id, but not sure yet
  • add tests for :index endpoint

References

Fixes #1291
Fixes #1290
Fixes #1289

Copy link
Contributor

@begedin begedin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of things, but nothing major


assert rendered_json == expected_json
end
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you move this here by accident?

conversation_id: conversation.id
}

{:ok, %ConversationPart{}} = Messages.add_part(attrs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should at least assert it belongs to the conversation here, if not checking the rest of the attributes.

assert result.id == conversation.id
end

test "should return conversation of a Conversation" do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This returns it for a conversation part

begedin
begedin previously approved these changes Dec 15, 2017
@joshsmith joshsmith merged commit 44e53c1 into develop Dec 15, 2017
@joshsmith joshsmith deleted the 1291-conversation-part-controller branch December 15, 2017 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants