-
Notifications
You must be signed in to change notification settings - Fork 11
Implement Sorting for Products API #98
Copy link
Copy link
Closed
Closed
Copy link
Labels
advancedComplex/advanced tasks or featuresComplex/advanced tasks or featuresapiAPI endpoints & integrationAPI endpoints & integrationbackendIssues related to backendIssues related to backendhacktoberfestSpecial issue for HacktoberfestSpecial issue for Hacktoberfesthacktoberfest-2025Special issue for Hacktoberfest 2025Special issue for Hacktoberfest 2025mongodbMongoDB & database managementMongoDB & database managementpriority: mediumImportant but not urgentImportant but not urgent
Milestone
Metadata
Metadata
Assignees
Labels
advancedComplex/advanced tasks or featuresComplex/advanced tasks or featuresapiAPI endpoints & integrationAPI endpoints & integrationbackendIssues related to backendIssues related to backendhacktoberfestSpecial issue for HacktoberfestSpecial issue for Hacktoberfesthacktoberfest-2025Special issue for Hacktoberfest 2025Special issue for Hacktoberfest 2025mongodbMongoDB & database managementMongoDB & database managementpriority: mediumImportant but not urgentImportant but not urgent
Type
Projects
Status
Done
Priority: Medium
Difficulty: Advanced
Type: Backend Feature
Description
Enhance the Products API to support sorting via query parameters.
Currently, sorting is done in the frontend. This task adds backend-side sorting for scalability and performance.
Requirements
Endpoint Update
GET /api/productsto accept asortquery parameter.best_selling(default).a_z(alphabetical ascending).z_a(alphabetical descending).price_asc(low to high).price_desc(high to low).rating_asc.rating_desc.Database Query
.sort()to return products in the requested order.Error Handling
sortparameter is provided, fallback to default (best_selling).Acceptance Criteria
GET /api/products?sort=price_ascreturns products sorted by ascending price.