SEMOSS / Semoss

Apache License 2.0
28 stars 5 forks source link

Added pagination for GetRoomMessagesReactor #214

Open jayesh00949 opened 3 weeks ago

jayesh00949 commented 3 weeks ago

All the messages of the room is getting sent together from the reactor to the frontend which is causing delay in loading the messages to the screen. So, we have added pagination for the response. Modifications - Added two parameters limit and offset in GetRoomMessagesReactor which are optional parameter and will be set to -1 if not sent from frontend. Overloaded the method "doRetreiveConversation" adding the parameter limit and offset and extracted the common code in addColumns method. In the overloaded method we are setting limit and offset to the query and also sorting it in desc order to get the latest message first.

kunal0137 commented 2 weeks ago

cleaned up some minor things but are we sure this is how we want this to work? im not sure how it would work in actual since you are switching to DESC sorted and then reversing the collection. seems odd but lets walk through an example of how an app would actually use it