G
G
GaserV2017-06-20 12:41:10
PHP
GaserV, 2017-06-20 12:41:10

How to design dialogue systems?

`Hi everyone! Tell me please. For convenience, I want to implement a LAN on my site in the form of dialogs with the ability to add interlocutors. Currently designed like this:
messages : id, dialog_id, user_id, content, date
dialogs : id, title, dates
dialog_file (for file attachments): id, dialog_id, file_id, date
user_dialog : id, user_id, dialog_id, unread, status, date
The algorithm is like this. Initially, the user writes a new message in the modal window to the user. On the back, I create a new dialog, make 1 insert in messages and make 2 inserts in user_dialog (1 for the sender, 2 for the recipient). Everything is recorded, everything seems to be good. But here I ran into a problem. The list of dialogues is displayed in the LAN. It will not be difficult to display the dialogue, but how to display the sender?
PS Perhaps somehow design differently? Tell me please.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
IceJOKER, 2017-06-20
@IceJOKER

messages: id, dialog_id, user_id, text , date
dialogs: id, title, date
dialog_file (for file attachments): id, user_id , dialog_id, file_id, date
dialog_user: id, user_id, dialog_id, unread, status, date
somehow So

B
Boris Korobkov, 2017-06-20
@BorisKorobkov

Files should be attached to message_id rather than dialog_id.
Should the added interlocutor see the entire dialogue, including messages written before the interlocutor was added to the dialogue?
does unread apply to all dialogs? And if the user read the entire dialogue, and then a new message was added there?
The sender of what: first message, last message, first unread message, etc.?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question