Closed Ochiengsteven closed 7 months ago
This pull request introduces a feature for users to favorite and unfavorite houses, as well as some related changes:
FavoritesController
HousesController
Users::RegistrationsController
Users::SessionsController
Favorite
House
User
index
create
destroy
authenticate_user!
show
respond_to_on_destroy
favorites
users
houses
Description
This pull request introduces a feature for users to favorite and unfavorite houses, as well as some related changes:
FavoritesController
to handle favorite/unfavorite actionsHousesController
to require authentication for creating housesUsers::RegistrationsController
andUsers::SessionsController
to return user data and JWT tokenFavorite
model to represent the association between users and housesHouse
andUser
models to establish associations withFavorite
Changes
FavoritesController
index
action to retrieve the current user's favorite housescreate
action to add a house to the user's favoritesdestroy
action to remove a house from the user's favoritesHousesController
authenticate_user!
)index
andshow
actionsUsers::RegistrationsController
Users::SessionsController
respond_to_on_destroy
method to handle logout responseModels
Favorite
model with associations toUser
andHouse
House
model with associations toUser
andFavorite
User
model with associations toHouse
andFavorite
Routes
FavoritesController
andHousesController
Database Migration
favorites
table with references tousers
andhouses
Notes