Closed ocebenzer closed 3 years ago
Also, i think it would be good to send all of a users conversations as one JSON file. Right now, I'm sending one request to get the conversations, and one for each conversation. This might be harsh for the backend server.
1- Yes, you are right. User id overwrites conversation id in backend response. I will correct it. 2- I thought that you may send request for a conversation when the user clicks to the particular conversation. I will create another endpoint for getting all messages. This endpoint might be useful in messaging page. GET all conversations endpoint still can be used in navigation bar in my perspective. These updates are coming soon.
2- If its implmeneted like that, it would cause a little delay between each conversation. But it might be better that way since all those conversations are stored which is quite inefficient. Still, it works either way which means the update is not essential.
I really appreciate the fast response
I implemented the new features.
Additionally, I realized GET conversations returns the conversations without an order. I ordered the conversation list by the "last_message" timestamp. The conversation with the newest "last_message" will be top of the list.
GET all messages API is useful to get every message data of the user, however if you use it solely, you can't use the "visited" functionality of the messaging system. If the user clicks on a particular conversation you have to send a GET request to "api/message/
I never thought about the visited situation, I need to send a GET request for each conversation no matter what..
Problem is solved, closing the issue
So I tried to use the message API and it works quite smoothly except a problem: I can't reach to the conversation id. It seems like the
id
in JSON body is always equal touser_id
, which is not intended. here is an example screenshot, the conversations have ids1,2
, in order, which can be reached if I know the ids: