Class LoginValidator
java.lang.Object
com.fiap.tech_challenge.parte1.ms_users.validators.LoginValidator
- All Implemented Interfaces:
UserValidator
Validator that checks if a given login is already registered in the system.
Implements the UserValidator
interface and uses UserRepository
to verify login uniqueness.
-
Constructor Summary
ConstructorsConstructorDescriptionLoginValidator
(UserRepository userRepository) Constructs aLoginValidator
with the givenUserRepository
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
validate
(UsersRequestDTO dto) Validates whether the login in the givenUsersRequestDTO
already exists.
-
Constructor Details
-
LoginValidator
Constructs aLoginValidator
with the givenUserRepository
.- Parameters:
userRepository
- the repository used to check if the login already exists.
-
-
Method Details
-
validate
Validates whether the login in the givenUsersRequestDTO
already exists.- Specified by:
validate
in interfaceUserValidator
- Parameters:
dto
- the DTO containing the user's login to validate.- Throws:
LoginAlreadyExistsException
- if the login is already registered in the system.
-