Skip to content

Added Register endpoints, tests and changed validation around user/sessions to match the test expectations when necessary#47

Merged
azunaVT merged 2 commits intomainfrom
feat/auth_v1_register_endpoint
Feb 2, 2026
Merged

Added Register endpoints, tests and changed validation around user/sessions to match the test expectations when necessary#47
azunaVT merged 2 commits intomainfrom
feat/auth_v1_register_endpoint

Conversation

@azunaVT
Copy link
Contributor

@azunaVT azunaVT commented Feb 2, 2026

🎉 Add Register Endpoint (User + Session Creation)

This PR implements the /api/v1/auth/register endpoint allowing a new user to register and be authenticated immediately.

What’s included

✅ New register action in Api::V1::AuthController

  • Accepts a nested user object with email, password, and password_confirmation
  • Creates a User and a Session if validations pass
  • Returns JSON with:
    • token for the session
    • basic user info

✅ Strong parameter handling + graceful error responses

  • Returns 422 Unprocessable Entity with error messages when input is invalid
  • No session is created when user creation fails

✅ Model validations for password length

  • Enforces a minimum password length before allowing registration

Error cases covered

  • Duplicate email
  • Invalid email format
  • Password confirmation mismatch
  • Short password
  • Missing parameters

Tests

Comprehensive integration tests have been added in:

  • test/integration/api_v1_auth_register_test.rb

Validations are covered for both the success path and all expected failure scenarios.

Routes

Register is scoped under POST /api/v1/auth/register

  • GET or other methods will return 404 Not Found (Rails default).
  • This endpoint is a key piece of the auth MVP, enabling new users to be onboarded and obtain session tokens.

@azunaVT azunaVT linked an issue Feb 2, 2026 that may be closed by this pull request
@azunaVT azunaVT merged commit 8a6bcce into main Feb 2, 2026
3 checks passed
@azunaVT azunaVT deleted the feat/auth_v1_register_endpoint branch February 2, 2026 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement /api/v1/auth/register endpoint

1 participant