Skip to content

feat: implement Infra layer for removing favorites / お気に入り解除のInfra層実装 - #572

Merged
zigzagdev merged 2 commits into
feat/user-favoritefrom
feat/user-favorite-remove-infra
Aug 16, 2026
Merged

feat: implement Infra layer for removing favorites / お気に入り解除のInfra層実装#572
zigzagdev merged 2 commits into
feat/user-favoritefrom
feat/user-favorite-remove-infra

Conversation

@zigzagdev

Copy link
Copy Markdown
Owner

Motivation / 目的

Add the Infra-layer piece needed to remove a favorite: a way to detach a world heritage site from a user's favorites. This is a shared dependency for both the favorites list screen (removing a card) and, later, the toggle heart button on the top/search/detail pages.

お気に入り解除に必要なInfra層の実装です。お気に入り一覧画面でのカード削除と、将来のトグルハートボタン(トップ/検索/詳細ページ)の両方から使われる共通の土台になります。

What I have done / 実施内容

  • Added FavoriteRepositoryInterface::removeFavorite(int $userId, int $worldHeritageSiteId): void
  • Implemented it in FavoriteRepository using $user->favorites()->detach()
  • Throws the same Exception('User not found.') as addFavorite when the user does not exist
  • Detaching a heritage that isn't currently favorited is a no-op (no exception)

Test Results / テスト結果

  • test_removeFavorite_detaches_world_heritage_site_from_user
  • test_removeFavorite_does_not_throw_when_not_favorited
  • test_removeFavorite_throws_exception_when_user_not_found

@codecov

codecov Bot commented Aug 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.38%. Comparing base (298153d) to head (63bdf49).

Additional details and impacted files

Impacted file tree graph

@@                   Coverage Diff                    @@
##             feat/user-favorite     #572      +/-   ##
========================================================
+ Coverage                 64.28%   64.38%   +0.09%     
- Complexity                 1677     1682       +5     
========================================================
  Files                       145      145              
  Lines                      8753     8776      +23     
========================================================
+ Hits                       5627     5650      +23     
  Misses                     3126     3126              
Files with missing lines Coverage Δ
...p/Packages/Domains/Favorite/FavoriteRepository.php 100.00% <100.00%> (ø)
.../Domains/Favorite/Tests/FavoriteRepositoryTest.php 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@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

@zigzagdev
zigzagdev merged commit f2c9a2a into feat/user-favorite Aug 16, 2026
28 checks passed
@zigzagdev
zigzagdev deleted the feat/user-favorite-remove-infra branch August 16, 2026 11:26
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.

Confirm favorites API endpoint paths (add/list/remove) — frontend and issue docs disagree

1 participant