Enable an API user to be able to filter and sort (asc and desc) each data field passed by GET /api/outfits. This is going to be a tricky one to do right. If no sorting or filtering attributes are passed, then all results are returned (subject to pagination if implemented). Both the filtering and sorting should be abstracted away from the API implementation in services/outfits.ts as seperate functions (schema.ts or utils/ could be a good home for these functions). You'll likely have to do some sort of "query building" to whittle down to the result that the user wants. For filtering, only consider "AND" or inner joins for now. Filtering like this is common practice in the industry, search the web for best practices.
For example, consider the case where I'd like to filter by rating. The user should be able to pass in a parameter where rating = 2 and all returned values should contain an outfit with a rating of 2. For sorting, say I'd like to sort by rating as well in asc order. Then the returned values should be sorted by such.
Description
Enable an API user to be able to filter and sort (asc and desc) each data field passed by GET /api/outfits. This is going to be a tricky one to do right. If no sorting or filtering attributes are passed, then all results are returned (subject to pagination if implemented). Both the filtering and sorting should be abstracted away from the API implementation in
services/outfits.ts
as seperate functions (schema.ts or utils/ could be a good home for these functions). You'll likely have to do some sort of "query building" to whittle down to the result that the user wants. For filtering, only consider "AND" or inner joins for now. Filtering like this is common practice in the industry, search the web for best practices.For example, consider the case where I'd like to filter by rating. The user should be able to pass in a parameter where rating = 2 and all returned values should contain an outfit with a rating of 2. For sorting, say I'd like to sort by rating as well in asc order. Then the returned values should be sorted by such.
Acceptance Criteria