feat: add User registration presentation layer / ユーザー登録プレゼンテーション層の追加 - #492
Merged
zigzagdev merged 7 commits intoJun 28, 2026
Merged
Conversation
3 tasks
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
With the domain, infrastructure, and application layers in place, the presentation layer is needed to expose user creation as an HTTP endpoint. This PR wires up the controller, view model, and route, completing the full vertical slice for user registration.
What I have done
passwordtoCreateUserCommandandUserRepositoryto satisfy theNOT NULLconstraint on theuserstableUserViewModelholding aUserDtoand exposingtoArray()for the JSON responseUserViewModelFactoryto buildUserViewModelfromUserDto, following the existing factory patternUserControllerwith acreateUseraction: on success returns 201 withUserViewModelFactory::build($dto)->toArray(); on any error returns 500 to the client and writes full details toLog::errorfor admin visibilityPOST /api/v1/user/createinroutes/api.phpUserRepositroyInterface→UserRepositoryinRepositoryProviderso Laravel's container can inject the dependency<coverage>section tophpunit.xml(HTML + Clover output); a coverage driver —pcovorxdebug— must be installed in the container to activate itモチベーション
ドメイン・インフラ・アプリケーション層が揃った状態で、ユーザー登録をHTTPエンドポイントとして公開するプレゼンテーション層が必要でした。このPRでコントローラー・ビューモデル・ルートを繋ぎ合わせ、ユーザー登録の縦断スライスを完成させます。
実装内容
CreateUserCommandとUserRepositoryにpasswordを追加(usersテーブルのNOT NULL制約を満たすため)UserViewModelを追加:UserDtoを保持し、JSONレスポンス用のtoArray()を公開UserViewModelFactoryを追加:既存のファクトリパターンに倣いUserDtoからUserViewModelを生成UserControllerを追加:成功時は201とUserViewModelFactory::build($dto)->toArray()を返却、エラー時はクライアントに500を返しつつLog::errorで詳細をadmin向けに記録routes/api.phpにPOST /api/v1/user/createを登録RepositoryProviderにUserRepositroyInterface→UserRepositoryのバインドを追加phpunit.xmlに<coverage>セクション(HTML + Clover出力)を追加。実行にはpcovまたはxdebugのインストールが必要Test Results