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 aLoginValidatorwith the givenUserRepository. -
Method Summary
Modifier and TypeMethodDescriptionvoidvalidate(UsersRequestDTO dto) Validates whether the login in the givenUsersRequestDTOalready exists.
-
Constructor Details
-
LoginValidator
Constructs aLoginValidatorwith the givenUserRepository.- Parameters:
userRepository- the repository used to check if the login already exists.
-
-
Method Details
-
validate
Validates whether the login in the givenUsersRequestDTOalready exists.- Specified by:
validatein interfaceUserValidator- Parameters:
dto- the DTO containing the user's login to validate.- Throws:
LoginAlreadyExistsException- if the login is already registered in the system.
-