Skip to content

Add Conversation and ConversationPart models and schemas #1286

@begedin

Description

@begedin

Problem

These two really go together, so we likely need to add them together.

We should not deal with changesets as part of this issue, as we really aren't sure yet what they might look like.

The idea is that a project can start a message with a user. This creates a Message record, with the following fields

  • initiated_by: "admin"
  • author - the project member who created it,
  • project - the project the author is creating the message in the name of

A Conversation record is then also created

  • belongs to the newly created message
  • belongs to the user the message is sent to

From the other side, a user can also message a project. This, again, creates a Message record, with the following fields:

  • initiated_by: "user"
  • author - the outside user who messaged the project
  • project - the project that gotmessaged

Again, a Conversation is also created

  • belongs to the user who sent the message
  • belongs to the project the message was sent to

In both cases, any side can then post further messages to the same conversation. This creates ConversationPart records

Conversation fields

  • status - "open"/"closed" - string, defaults to "open"
  • read_at - timestamp, defaults to null
  • belongs_to :message - cannot be null
  • belongs_to :user - cannot be null
  • has_many :conversation_parts

ConversationPart fields

  • body
  • read_at (by admin in project if author is user, otherwise by user)
  • belongs_to :author
  • belongs_to :conversation

Subtasks

  • Add migration with the "conversations" and "conversation_parts" tables
  • Add lib/code_corps/model/conversation.ex
  • Add lib/code_corps/model/conversation_part.ex

References

  • we need to get Add messages #1278 merged, so we have a Message model to link Conversation with

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions