[Backend] Fetch Questions Sorted by Recent or Top-Rated Options #662
Labels
component: backend
About backend
priority: medium
Medium priority
type: enhancement
New feature or request
Milestone
📌 Feature: Add
sortBy
Parameter to Search Questions API🏡 Component
📚 Detailed Description
Enhance the
/search/questions
endpoint to allow sorting of search results by different criteria using a new query parametersortBy
. This will enable fetching questions in either "recent" or "top-rated" order. It is needed for compatibility for pagination in mobile.Existing Endpoint Specification
📝 Proposed Changes
Add
sortBy
parameter: Introduce a new query parametersortBy
to the/search/questions
endpoint. This will allow sorting the results by eitherrecent
ortop-rated
.recent
recent
,top-rated
Update API behavior: Modify the existing API logic to account for the
sortBy
parameter and return questions sorted by the selected value.Default sorting: If
sortBy
is not provided, the API should default torecent
sorting.Adjust result order: Ensure that the returned questions are ordered according to the specified
sortBy
parameter, overriding the page-by-page ordering.Schema:
📋 Acceptance Criteria
sortBy
parameter should be added to the/search/questions
endpoint.sortBy
parameter can accept values"recent"
or"top-rated"
.sortBy
parameter (either recent or top-rated).sortBy
is not provided, the results should default to"recent"
.sortBy
parameter should work together with other parameters likeq
,tags
,difficulty
,page
, andpageSize
.👁🗨 Reviewer
@atakanyasar
The text was updated successfully, but these errors were encountered: