radicalplatforms / shafa

A wardrobe logging, composition, and organization app
https://shafa.app
Mozilla Public License 2.0
0 stars 0 forks source link

Add dynamic filtering, sorting to GET /api/items #93

Open rak3rman opened 6 months ago

rak3rman commented 6 months ago

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

Generated by Zenhub AI