Class UserServiceImpl
java.lang.Object
dev.fernando.user_authentication_api.service.impl.UserServiceImpl
- All Implemented Interfaces:
UserService
-
Constructor Summary
ConstructorsConstructorDescriptionUserServiceImpl
(UserRepository userRepository, org.springframework.security.crypto.password.PasswordEncoder passwordEncoder, UserPublisher userEventPublisher) -
Method Summary
Modifier and TypeMethodDescriptioncreateUserWithDefaultRole
(CreateUserDto createUserDto) Creates a new user with default USER role aboutUserRole
, in other words, a client of user service.deleteUserByEmail
(String email) Deletes a user by their email.deleteUserById
(Long id) Deletes a user by their ID.findUserByEmail
(String email) Finds a user by their email.findUserById
(Long id) Finds a user by their ID.updateUser
(Long id, UpdateUserDto updateUserDto) updates an existing user as long as the current password is confirmed during the update.
-
Constructor Details
-
UserServiceImpl
@Autowired public UserServiceImpl(UserRepository userRepository, org.springframework.security.crypto.password.PasswordEncoder passwordEncoder, UserPublisher userEventPublisher)
-
-
Method Details
-
findUserById
Description copied from interface:UserService
Finds a user by their ID.- Specified by:
findUserById
in interfaceUserService
- Parameters:
id
- the ID of the user to find- Returns:
- the user details which includes ID, username, email, role, phone, cpf, birthdate and creation date
-
findUserByEmail
Description copied from interface:UserService
Finds a user by their email.- Specified by:
findUserByEmail
in interfaceUserService
- Parameters:
email
- the email of the user to find- Returns:
- the user details which includes ID, username, email, role, phone, cpf, birthdate and creation date
-
createUserWithDefaultRole
Description copied from interface:UserService
Creates a new user with default USER role aboutUserRole
, in other words, a client of user service.- Specified by:
createUserWithDefaultRole
in interfaceUserService
- Parameters:
createUserDto
- the details of the user to create- Returns:
- the created user details which includes ID, username, email, role, phone, cpf, birthdate and creation date
-
updateUser
Description copied from interface:UserService
updates an existing user as long as the current password is confirmed during the update.- Specified by:
updateUser
in interfaceUserService
- Parameters:
id
- the ID of the user to updateupdateUserDto
- the new details for the user- Returns:
- the updated user details which includes ID, username, email, role, phone, cpf, birthdate and creation date
-
deleteUserById
Description copied from interface:UserService
Deletes a user by their ID.- Specified by:
deleteUserById
in interfaceUserService
- Parameters:
id
- the ID of the user to delete- Returns:
- the deleted user details which includes ID, username, email, role, phone, cpf, birthdate and creation date
-
deleteUserByEmail
Description copied from interface:UserService
Deletes a user by their email.- Specified by:
deleteUserByEmail
in interfaceUserService
- Parameters:
email
- the email of the user to delete- Returns:
- the deleted user details which includes ID, username, email, role, phone, cpf, birthdate and creation date
-