Skip to content

feat: implement Application layer for User Update API / ユーザー更新APIのApplication層実装#518

Merged
zigzagdev merged 10 commits into
feat/user_updatefrom
feat/user_update-application_layer
Jul 2, 2026
Merged

feat: implement Application layer for User Update API / ユーザー更新APIのApplication層実装#518
zigzagdev merged 10 commits into
feat/user_updatefrom
feat/user_update-application_layer

Conversation

@zigzagdev

@zigzagdev zigzagdev commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Motivation / 目的

Implement the Application layer for the User Update API as part of #500.
Also refactors UserViewModel and UserViewModelFactory from CommandUseCases to QueryUseCases following the CQS principle.

ユーザー更新APIのApplication層(#500)を実装しました。
またCQS原則に基づき、UserViewModelUserViewModelFactoryCommandUseCases から QueryUseCases へ移動しました。

What I have done / 実施内容

Application層

  • UpdateUserCommand: required fields are id, first_name, last_name, email, age_range, subscription_tier — password is intentionally excluded (password change is a separate API)
  • UpdateUserUseCase: build UserEntity from command via UserEntityFactory, call UserRepositroyInterface::updateUser(), return UserDto

CQS リファクタリング

  • Moved UserViewModelQueryUseCases/ViewModel/User/
  • Moved UserViewModelFactoryQueryUseCases/Factory/ViewModel/
  • Moved corresponding tests → QueryUseCases/Tests/ViewModel/
  • Updated UserController import accordingly

Why: UserViewModel is a read/presentation object used in both createUser (Command) and getUserById (Query). Placing it in QueryUseCases correctly reflects its read-side nature per CQS.

Test Results / テスト結果

  • test_fromArray_creates_command_with_valid_data
  • test_fromArray_sets_subscription_expires_at_when_provided
  • test_fromArray_throws_when_required_key_is_missing (6 cases)
  • test_handle_passes_entity_to_repository_and_returns_dto

Closes #502

@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.00000% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.47%. Comparing base (0a1b83a) to head (1ee3c41).

Files with missing lines Patch % Lines
...es/Tests/CommandUseCases/UpdateUserCommandTest.php 77.50% 9 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                  Coverage Diff                   @@
##             feat/user_update     #518      +/-   ##
======================================================
+ Coverage               59.06%   59.47%   +0.41%     
- Complexity               1488     1503      +15     
======================================================
  Files                     115      119       +4     
  Lines                    7575     7675     +100     
======================================================
+ Hits                     4474     4565      +91     
- Misses                   3101     3110       +9     
Files with missing lines Coverage Δ
...CommandUseCases/UseCase/User/UpdateUserUseCase.php 100.00% <100.00%> (ø)
...mandUseCases/UseCommand/User/UpdateUserCommand.php 100.00% <100.00%> (ø)
...pp/Packages/Features/Controller/UserController.php 77.77% <ø> (ø)
...seCases/Factory/ViewModel/UserViewModelFactory.php 100.00% <ø> (ø)
...Cases/Tests/ViewModel/UserViewModelFactoryTest.php 100.00% <ø> (ø)
...ueryUseCases/Tests/ViewModel/UserViewModelTest.php 100.00% <ø> (ø)
...res/QueryUseCases/ViewModel/User/UserViewModel.php 100.00% <ø> (ø)
...es/Tests/CommandUseCases/UpdateUserUseCaseTest.php 100.00% <100.00%> (ø)
...es/Tests/CommandUseCases/UpdateUserCommandTest.php 77.50% <77.50%> (ø)
🚀 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 changed the title Feat/user update application layer feat: implement Application layer for User Update API / ユーザー更新APIのApplication層実装 Jul 2, 2026
@zigzagdev zigzagdev self-assigned this Jul 2, 2026

@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 3e4b21f into feat/user_update Jul 2, 2026
27 checks passed
@zigzagdev zigzagdev deleted the feat/user_update-application_layer branch July 2, 2026 00:34
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 User Update API / ユーザー更新APIのApplication層実装

1 participant