potpie
potpie copied to clipboard
Add Sort Parameters for Conversations API
Description
Currently, the conversations API does not provide a way to sort the returned conversations. Users need the ability to sort conversations by different fields and ordering to easily find the conversations they're looking for.
Current Behavior
The current API returns conversations without any sorting options, making it difficult for users to find specific conversations, especially when they have many of them.
Expected Behavior
Add two query parameters to the conversations list API endpoint:
sort- Field to sort by (supportsupdated_atorcreated_at)order- Direction of sort (ascordesc)
Proposed Implementation
-
Add query parameters to the API endpoint that lists conversations:
sort: Accepts valuesupdated_atorcreated_at(default tocreated_atif not specified)order: Accepts valuesascordesc(default todescif not specified)
-
Update the database query to include the appropriate ORDER BY clause based on these parameters
Code Location
app/modules/conversations/conversations_router.py- Relevant function: List conversations endpoint