Interface UserRepositoryAdapter
- All Known Implementing Classes:
UserRepositoryAdapterImpl
public interface UserRepositoryAdapter
Abstracts user repository operations with exception translation for domain-specific errors.
-
Method Summary
Modifier and TypeMethodDescriptionFinds a user by their unique ID.findByUsername(String username) Finds a user by username.findByUsernameOrEmail(String usernameOrEmail) Finds a user by username or email address.save(CreateUserCommand command) Persists a new user entity.update(UserEntity userEntity) Updates an existing user entity.
-
Method Details
-
save
Persists a new user entity.- Parameters:
command- user creation details- Returns:
- the saved user entity
- Throws:
UsernameTakenException- if username already existsEmailTakenException- if email already existsFailedToCreateUserException- for other persistence failures
-
findByUsernameOrEmail
Finds a user by username or email address.- Parameters:
usernameOrEmail- the username or email to search for- Returns:
- the matching user entity
- Throws:
UserNotFoundException- if no user is foundFailedToFindUserException- for database errors
-
findByUsername
Finds a user by username.- Parameters:
username- the username to search for- Returns:
- the matching user entity
- Throws:
UserNotFoundException- if no user is foundFailedToFindUserException- for database errors
-
findById
Finds a user by their unique ID.- Parameters:
id- the user ID to search for- Returns:
- the matching user entity
- Throws:
UserNotFoundException- if no user is foundFailedToFindUserByIdException- for database errors
-
update
Updates an existing user entity.- Parameters:
userEntity- the user entity with updated values- Returns:
- the updated user entity
- Throws:
UsernameTakenException- if updated username is already takenEmailTakenException- if updated email is already takenFailedToUpdateUserException- for database update failures
-