Skip to content

feat: implement Infra layer for user favorites repository / お気に入り機能のInfra層実装 - #561

Merged
zigzagdev merged 4 commits into
feat/user-favoritefrom
feat/user-favorite_infra-layer
Aug 6, 2026
Merged

feat: implement Infra layer for user favorites repository / お気に入り機能のInfra層実装#561
zigzagdev merged 4 commits into
feat/user-favoritefrom
feat/user-favorite_infra-layer

Conversation

@zigzagdev

Copy link
Copy Markdown
Owner

Motivation

Following the domain-layer migration for the user_favorite join table (#560), this PR implements the Infra layer for the favorites feature: a FavoriteRepositoryInterface and its Eloquent-backed FavoriteRepository implementation, allowing a user to add a world heritage site to their favorites.

What I have done

  • Added a User::favorites() BelongsToMany relation to WorldHeritage via the user_favorite pivot table
  • Added FavoriteRepositoryInterface with addFavorite(int $userId, int $worldHeritageSiteId): void
  • Added FavoriteRepository, implementing the interface via $user->favorites()->attach(), throwing an exception when the user is not found
  • Bound FavoriteRepositoryInterface to FavoriteRepository in RepositoryProvider
  • Added an integration test for FavoriteRepository against the real test database

Test Results

  • test_addFavorite_attaches_world_heritage_site_to_user
  • test_addFavorite_throws_exception_when_user_not_found

@zigzagdev zigzagdev left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: implement Infra layer for Favorite Heritage API / お気に入りAPIのInfra層実装

1 participant