Skip to content

feat: Add user favorites system#155

Open
Said-MZ wants to merge 5 commits into
ieasybooks:mainfrom
Said-MZ:feature/favorites
Open

feat: Add user favorites system#155
Said-MZ wants to merge 5 commits into
ieasybooks:mainfrom
Said-MZ:feature/favorites

Conversation

@Said-MZ

@Said-MZ Said-MZ commented Sep 20, 2025

Copy link
Copy Markdown
Contributor

Closes #34

This PR implements the complete user favorites system requested in issue #34, enabling users to favorite books and view them in a dedicated interface.

  • Users can favorite/unfavorite books with heart icon buttons
  • Favorites filtering on main books page with toggle button

Technical Implementation

  • Model: Favorite with user-book associations and uniqueness constraints
  • Routes:
    • GET /favorites - User's favorites listing page
    • POST /books/:book_id/favorites - Add favorite
    • DELETE /books/:book_id/favorites/:id - Remove favorite
  • Components:
    • FavoriteButton - Heart icon for individual books
    • FavoritesToggle - Filter toggle for book listings
Screenshot 2025-09-20 at 1 11 23 PM Screenshot 2025-09-20 at 1 11 13 PM Screenshot 2025-09-20 at 1 11 08 PM

Additional Cleanup

  • Removed debug code user_signed_in? from categories view that - i assume - was accidentally left during development
Screenshot 2025-09-20 at 1 01 04 PM

Add complete favorites functionality including:
- Favorite/unfavorite books with instant UI updates
- Filter books by favorites status
- Change favorites associations to use dependent: :delete_all for better performance
- Remove redundant user_id index since composite index covers the same queries
@Said-MZ

Said-MZ commented Oct 7, 2025

Copy link
Copy Markdown
Contributor Author

@AliOsm please review when u have the time, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

تمكين المستخدمين في تفضيل بعض الكتب

1 participant