Enable an API user to be able to filter and sort (asc and desc) each data field passed by GET /api/items. 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/items.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 name. The user should be able to pass in a parameter where name = Radison and all returned values should contain Radison. For sorting, say I'd like to sort by created_date 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/items. 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/items.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 name. The user should be able to pass in a parameter where name = Radison and all returned values should contain Radison. For sorting, say I'd like to sort by created_date in asc order. Then the returned values should be sorted by such.
Acceptance Criteria