Skip to content

feat: add User registration application layer - #491

Merged
zigzagdev merged 6 commits into
feat/user_registerfrom
feat/user_register-application_layer
Jun 28, 2026
Merged

feat: add User registration application layer#491
zigzagdev merged 6 commits into
feat/user_registerfrom
feat/user_register-application_layer

Conversation

@zigzagdev

Copy link
Copy Markdown
Owner

Motivation

With the infrastructure layer in place, the application layer is needed to orchestrate user creation. This PR introduces the command/use-case structure that sits between the presentation layer and the repository, providing input validation and a clear entry point for the create-user flow.

What I have done

  • Added CreateUserCommand — validates that all required keys (first_name, last_name, email, age_range, subscription_tier) are present in the incoming array; exposes data via public readonly properties
  • Added CreateUserUseCase — receives a CreateUserCommand and delegates to UserRepositoryInterface, returning a UserDto
  • Added UserDtoFactory — follows the existing factory pattern under QueryUseCases/Factory/Dto/; builds a UserDto from a raw attribute array
  • Updated UserDto — replaced the empty stub with typed public readonly properties
  • Updated UserRepositoryInterface and UserRepository — changed the signature from UserEntity to CreateUserCommand; the repository now converts the command to DB columns directly and uses UserDtoFactory to build the return value
  • Updated UserRepositoryTest — aligned with the new CreateUserCommand-based signature; mocks toArray() on the inserted model to feed UserDtoFactory

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 changed the base branch from main to feat/user_register June 28, 2026 09:25
@zigzagdev zigzagdev linked an issue Jun 28, 2026 that may be closed by this pull request
3 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 merged commit 3e8a0ab into feat/user_register Jun 28, 2026
25 checks passed
@zigzagdev
zigzagdev deleted the feat/user_register-application_layer branch June 28, 2026 09:27
@zigzagdev
zigzagdev restored the feat/user_register-application_layer branch June 28, 2026 10:13
@zigzagdev
zigzagdev deleted the feat/user_register-application_layer branch June 28, 2026 10:16
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 Application Layer

1 participant