djangoflow / django-df-chat

Djangoflow in-app chat server using django-channels
MIT License
0 stars 16 forks source link

WIP: Message reactions #47

Open atodorov opened 8 months ago

eugapx commented 8 months ago

Pros and cons seems reasonable for me.

I think we also need to understand is option 2/3 will be as performant as option 1 for API queries and WS updates. With option 1 it's easy to prefetch all reactions.

We also may need to group reaction by type, so API response will look like this.

{
      "id": 345667,
      "content": "Hello!",
      "reactions": [
          {
               "content": "👍",
               "reactions": [
                   {
                        "id": 3456789,
                        "created_by": { ... },
                        ...
                   }
               ]  
          }
      ]
}

Will we be able to achieve good solution with options 2/3?

related_message = models.ForeignKey("self", blank=True, null=True, on_delete=models.CASCADE, related_name="reactions")

We also can have replies to the messages as described here #45.

Could you update design for this task with broader context of task #45.

Also I want to add which option is better for live updates via WS