skype-clone
skype-clone copied to clipboard
/get_message_detail endpoint
@Yassermorteza please make this endpoint as per our phone conversation and you can find its detailed description from the following list:
- It should be a post method and expect two params; userID & friendID
- Query chat.participants and get the _id with the combinations participants[userID, friendID] || participants[friendID, userID] as the initial click on the friend list may occur from either side.
- If the query returns a result, get all the messages of that chat id, curate an object and send it back along with the chat._id
- If the query doesn't return a result (means it is the first time these two friends are chatting), then insert a record in chat collection and return chat._id as it will be used for the socket.io room.
Good luck hacking 👍 💻 👨💻