upswyng
upswyng copied to clipboard
default sort by favorites
related to #465 and #466
Description
When retrieving resources by category or subcategory, our API endpoint returns the list sorted by those open as well as those closest to the user. It'd be useful to update this sort to consider the user's favorites.
Checklist
- [ ] when retrieving resources by a category and sub-category, and the user has favorites, the list of resources provided is sorted in the following order by default:
- resources that are open AND favorited sorted by those closest to the user
- resources that are open and NOT favorited sorted by those closest to the user
- resources that are closed AND favorited sorted by those closest to the user
- resources that are closed and NOT favorited sorted by those closest to the user
- [ ] when retrieving resources by a category and sub-category, and the user does not have favorites, the list of resources is not sorted by favorites
Tech Notes
- Favorites are stored in local storage, so we'll either need to send that list of favorites to the associated routes OR do the sorting on the front-end
- example of retrieving favorited resources
- Category API Route
- Category Model
- Subcategory API Route
- Sub-category Model