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:UserServiceFinds a user by their ID.- Specified by:
findUserByIdin 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:UserServiceFinds a user by their email.- Specified by:
findUserByEmailin 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:UserServiceCreates a new user with default USER role aboutUserRole, in other words, a client of user service.- Specified by:
createUserWithDefaultRolein 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:UserServiceupdates an existing user as long as the current password is confirmed during the update.- Specified by:
updateUserin 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:UserServiceDeletes a user by their ID.- Specified by:
deleteUserByIdin 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:UserServiceDeletes a user by their email.- Specified by:
deleteUserByEmailin 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
-