Skip to content

feat: implement Application layer for adding favorites / お気に入り追加のApplication層実装 - #562

Merged
zigzagdev merged 2 commits into
feat/user-favoritefrom
feat/user-favorite-application
Aug 6, 2026
Merged

feat: implement Application layer for adding favorites / お気に入り追加のApplication層実装#562
zigzagdev merged 2 commits into
feat/user-favoritefrom
feat/user-favorite-application

Conversation

@zigzagdev

Copy link
Copy Markdown
Owner

Motivation / 目的

Following the Infra layer (#561), this PR implements the Application layer for the favorites feature: an AddFavoriteUseCase that lets a user add a world heritage site to their favorites via FavoriteRepositoryInterface.

No UseCommand or Dto is introduced here — handle() only needs user_id and world_heritage_id, and the operation returns void, so passing primitives directly follows the existing DeleteUserUseCase pattern rather than adding an object wrapper for two scalar values.

What I have done / 実施内容

  • Added AddFavoriteUseCase::handle(int $userId, int $worldHeritageSiteId): void, delegating to FavoriteRepositoryInterface::addFavorite()
  • Added a unit test for AddFavoriteUseCase using Mockery

Test Results / テスト結果

  • test_handle_calls_repository_addFavorite_with_given_ids
  • test_handle_propagates_exception_when_user_not_found

@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.28%. Comparing base (4c6e5a0) to head (8755795).

Additional details and impacted files

Impacted file tree graph

@@                   Coverage Diff                    @@
##             feat/user-favorite     #562      +/-   ##
========================================================
+ Coverage                 63.18%   63.28%   +0.09%     
- Complexity                 1635     1640       +5     
========================================================
  Files                       138      140       +2     
  Lines                      8475     8497      +22     
========================================================
+ Hits                       5355     5377      +22     
  Misses                     3120     3120              
Files with missing lines Coverage Δ
...ndUseCases/UseCase/Favorite/AddFavoriteUseCase.php 100.00% <100.00%> (ø)
...s/Tests/CommandUseCases/AddFavoriteUseCaseTest.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 cb94ab5 into feat/user-favorite Aug 6, 2026
28 checks passed
@zigzagdev
zigzagdev deleted the feat/user-favorite-application branch August 6, 2026 23:44
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 Application layer for Favorite Heritage API / お気に入りAPIのApplication層実装

1 participant