I am trying to implement a chat in my app and having difficulties with the scheme.
I wanted to add the following to the normal chat functionality:
There should be a group chat.
It should be shown who read the message and when.
If someone is typing this should be displayed.
My idea so far was the following scheme:
Class Chat
{groupName (String), author (pointer: User), members (relation: User), messages (relation: ChatMessages), isGroupChat (bool)}
The question I am asking myself is, should I set a relation to messages or is it better to just set a pointer in the ChatMessages class to Chat? `
Class ChatMessages
{chat (pointer: Chat), message (String), readBy (relation: ChatReadBy)}
Same question here. Set a pointer or simply a pointer / relation from Chat to ChatMessages?
Class ChatReadBy
{user (pointer: User), createdAt (Date)}
Then the question remains, where do I put isTyping?
And the most important question, does the scheme I have set up make sense at all?
Since many have probably already implemented a chat functionality, I hope that you can help me or give a few tips.