fix(architecture): adapt for clean architecture#88
Closed
MayuriXx wants to merge 1 commit into
Closed
Conversation
|
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.




🔁 Renames
LocalUserService → UserService (domain/services/) — the "Local" prefix was redundant for a domain service interface
User (JPA entity) → UserDao (data/models/database/) — clearly distinguishes the persistence model from the domain model (UserEntity)
feature/ directory → features/ (src/test/java/) — consistency with the .feature files directory (src/test/resources/features/)
🆕 New files
presentation/dto/UserDTO.java — HTTP response DTO, decouples domain entities from the API contract
presentation/dto/UserRequestDTO.java — HTTP input DTO (moved from domain/entities/UserRequest.java)
presentation/dto/UserRequestDTO.java — HTTP input DTO (moved from domain/entities/UserRequest.java)
presentation/mappers/UserMapper.java — static mapper UserEntity → UserDTO
domain/services/UserService.java — domain service interface (replaces LocalUserService)
data/models/database/UserDao.java — renamed JPA entity (replaces User.java)
data/sources/api/UserApiConfig.java — unified Retrofit configuration (merges DummyUserApiConfig + RandomUserApiConfig)
config/UseCaseConfig.java — Spring @bean declarations for all use cases, replacing @service annotations in the domain layer
✏️ Structural changes
UserRequest removed from domain: CreateUserUseCase and UpdateRandomUserUseCase now accept a UserEntity (with null id); the mapping from UserRequestDTO is handled in UserHandler via toUserEntity()
@service removed from use cases (domain/usecases/): the domain layer no longer depends on the Spring Framework
Database-level pagination on filterUsers: UserService.filterUsers(UserFilter, int page, int size) uses PageRequest + JpaSpecificationExecutor to paginate directly in the database (Page)
Spring Pageable on getRandomUsers and filterUsers: page/size parameters are injected via @PageableDefault — both endpoints now return a paginated UserResponseDTO
Domain entities no longer cross the HTTP boundary: all endpoints return UserDTO or UserResponseDTO
🗑️ Deleted files
data/models/database/User.java
domain/entities/UserRequest.java
domain/services/LocalUserService.java
data/sources/api/dummy/DummyUserApiConfig.java
data/sources/api/randomuser/RandomUserApiConfig.java
🧪 Tests
All unit tests updated (UserHandlerTest, UserServiceImplTest, UserConverterTest, UserSpecificationsTest, use cases, Cucumber)
UserGetByIdContainerTest migrated to UserDao and UserDTO
78 tests — 0 failures, 0 errors