Skip to content

Bug: POST /api/v1/user/create fails because subscription_tier is required / ユーザー作成APIがsubscription_tier必須のため失敗する #549

Description

@zigzagdev

Motivation / 目的

POST /api/v1/user/create を実際のサインアップフォームから呼び出すと常に失敗していた。フォームは first_name / last_name / email / password / age_range のみを送信しており、subscription_tier を含めていなかったため。

Calling POST /api/v1/user/create from the actual signup form always failed. The form only sends first_name / last_name / email / password / age_range, and never subscription_tier.

調査でわかったこと / What we found

  • CreateUserCommand::fromArraysubscription_tier を必須キーとしていたため、リクエストは常に InvalidArgumentException(Missing required key: subscription_tier、実際には配列の並び順の都合で age_range の欠落として先に検出されるケースもあった)で失敗していた
  • UserController::createUserdd($request) のデバッグ用コードが残っており、それ自体もリクエスト処理を止めていた
  • subscription_tier を単純に任意化しただけでは、CreateUserUseCasenull をそのまま SubscriptionTier::from() に渡してしまい、今度は ValueError("0" is not a valid backing value for enum SubscriptionTier 等)で失敗する別の問題が新たに顕在化した

対応方針 / Proposed fix

  • UserController::createUser から dd($request) を削除
  • CreateUserCommand の必須キーから subscription_tier を外す(age_range は必須のまま維持)
  • CreateUserUseCasesubscription_tier が未指定の場合は free をデフォルト適用する

Test Results / テスト結果

対応PR #548 を参照

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions