feat: implement User Update API / ユーザー更新APIの実装#520
Merged
Conversation
…ayer feat: implement Application layer for User Update API / ユーザー更新APIのApplication層実装
…layer
feat: implement Presentation layer for PATCH /api/v1/users/{id} / ユーザー更新APIのPresentation層実装
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feat/user #520 +/- ##
===============================================
+ Coverage 59.06% 59.94% +0.88%
- Complexity 1488 1515 +27
===============================================
Files 115 120 +5
Lines 7575 7765 +190
===============================================
+ Hits 4474 4655 +181
- Misses 3101 3110 +9
🚀 New features to boost your workflow:
|
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation / 目的
Implement the User Update API (
PATCH /api/v1/users/{id}) across all layers as part of #500.ユーザー更新API(
PATCH /api/v1/users/{id})をInfra・Application・Presentation層にわたって実装しました(#500)。What I have done / 実施内容
Infra層 (PR #505)
UserRepositroyInterface:updateUser(UserEntity $entity): UserDtoを追加UserRepository:updateUser実装Exceptionをスローrefresh()後にUserDtoとして返却UserRepositoryTest: MockeryベースのユニットテストからDBを使ったインテグレーションテストに刷新Application層 (PR #518)
UpdateUserCommand:id必須・パスワードなし(パスワード変更は別API)UpdateUserUseCase:UpdateUserCommandからUserEntityを組み立ててupdateUserを呼び出すUserViewModel/UserViewModelFactoryをCommandUseCasesからQueryUseCasesへ移動(読み取り専用オブジェクトのため)Presentation層 (PR #519)
UserController::updateUser(): ルートの{id}とリクエストボディをマージしてUpdateUserCommandを生成し、UpdateUserUseCaseを実行'User not found.'例外)Log::errorでログ記録)PATCH /api/v1/users/{id}Test Results / テスト結果
Infra層
test_createUser_persists_and_returns_user_dtotest_findById_returns_user_dto_when_user_existstest_findById_returns_null_when_user_does_not_existtest_updateUser_returns_user_dto_on_successtest_updateUser_throws_exception_when_user_not_foundApplication層
test_update_user_command_builds_from_arraytest_update_user_command_throws_when_required_key_is_missingtest_handle_returns_user_dto_on_successtest_handle_calls_repository_with_correct_entityPresentation層
test_update_user_returns_200_with_updated_datatest_update_user_returns_404_when_user_not_foundtest_update_user_returns_500_when_required_key_is_missingCloses #500