bounswe / bounswe2020group9

0 stars 4 forks source link

Message API - cannot reach to the conversation id #300

Closed ocebenzer closed 3 years ago

ocebenzer commented 3 years ago

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 to user_id, which is not intended. here is an example screenshot, the conversations have ids 1,2, in order, which can be reached if I know the ids: Screenshot_2

ocebenzer commented 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.

mehmetkemaloglu commented 3 years ago

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.

ocebenzer commented 3 years ago

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

mehmetkemaloglu commented 3 years ago

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//" to mark the messages visited.

ocebenzer commented 3 years ago

I never thought about the visited situation, I need to send a GET request for each conversation no matter what..

ocebenzer commented 3 years ago

Problem is solved, closing the issue