Skip to content

feat: add User registration infrastructure layer - #490

Merged
zigzagdev merged 3 commits into
feat/user_registerfrom
feat/user_register-infra_layer
Jun 28, 2026
Merged

feat: add User registration infrastructure layer#490
zigzagdev merged 3 commits into
feat/user_registerfrom
feat/user_register-infra_layer

Conversation

@zigzagdev

@zigzagdev zigzagdev commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Motivation

The application needs a persistence layer for the User domain. Without a repository, there is no way to create users from the application layer.
This PR introduces the infrastructure layer that bridges the UserEntity domain object and the Eloquent User model, providing a clean boundary between domain logic and database concerns.

What I have done

  • Added UserRepositoryInterface to define the contract for user persistence
  • Added UserRepository implementing the interface with Eloquent, mapping UserEntity fields (email, first_name, last_name, age_range, subscription_tier, subscription_expires_at) to the fillable columns and using wasRecentlyCreated to detect insert failures
  • Added UserDto as a stub returned by createUser (full implementation deferred to next branch)
  • Fixed SubscriptionFactory namespace mismatch — the file lived under Factory/ but declared namespace Subscription; corrected to Factory and added missing use statements for Subscription and SubscriptionTier
  • Updated UserEntityFactory import to match the corrected SubscriptionFactory namespace
  • Added unit tests using Mockery (to mock the static Model::create()) and Faker (to generate randomised, non-duplicate test data)

Test Results

PASS  Tests\Unit\Packages\Domains\UserRepositoryTest
✓ create user returns user dto on success
✓ create user throws exception when insert fails

Tests: 2 passed (3 assertions)

@zigzagdev zigzagdev self-assigned this Jun 28, 2026
@zigzagdev zigzagdev linked an issue Jun 28, 2026 that may be closed by this pull request
2 tasks

@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 changed the base branch from main to feat/user_register June 28, 2026 08:21
@zigzagdev
zigzagdev merged commit d7553e9 into feat/user_register Jun 28, 2026
25 checks passed
@zigzagdev
zigzagdev deleted the feat/user_register-infra_layer branch June 28, 2026 08:22
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.

Create Infrastructure Layer

1 participant