Interface UserWorkerMutationService
- All Known Implementing Classes:
UserWorkerMutationServiceImpl
public interface UserWorkerMutationService
Service that handles the mutation of the user and worker data
-
Method Summary
Modifier and TypeMethodDescriptionchangeEmail
(String newEmail, String oldEmail) Change email in the databasevoid
changePassword
(String oldPassword, String newPassword) Change password in the databasevoid
logout()
Logs out the user / workerrefreshAccessToken
(JWT token, JWT refreshToken) Refresh the access token, and the refresh token in the database
-
Method Details
-
logout
void logout() throws TokenNotInRedisException, UserNotFoundException, AuthenticationCredentialsNotFoundExceptionLogs out the user / worker- Throws:
TokenNotInRedisException
- if the token is not in redisUserNotFoundException
- if the user is not foundAuthenticationCredentialsNotFoundException
- if the authentication credentials are not found in the request
-
refreshAccessToken
JWTSet refreshAccessToken(JWT token, JWT refreshToken) throws UserNotFoundException, InvalidRefreshTokenException, UserOrWorkerIDNotFoundException Refresh the access token, and the refresh token in the database- Parameters:
token
- the access tokenrefreshToken
- the refresh token- Returns:
- the new JWTSet
- Throws:
UserNotFoundException
- if the user is not foundInvalidRefreshTokenException
- if the refresh token is invalidUserOrWorkerIDNotFoundException
- if the user or worker id is not found
-
changePassword
void changePassword(String oldPassword, String newPassword) throws UserNotFoundException, WrongPasswordException, AuthenticationCredentialsNotFoundException Change password in the database- Parameters:
oldPassword
- the old passwordnewPassword
- the new password- Throws:
UserNotFoundException
- if the user is not foundWrongPasswordException
- if the old password is wrongAuthenticationCredentialsNotFoundException
- if the authentication credentials are not found in the request
-
changeEmail
String changeEmail(String newEmail, String oldEmail) throws UserNotFoundException, AuthenticationCredentialsNotFoundException, InvalidEmailException Change email in the database- Parameters:
newEmail
- the new emailoldEmail
- the old email- Returns:
- the new email
- Throws:
UserNotFoundException
- if the user is not foundAuthenticationCredentialsNotFoundException
- if the authentication credentials are not found in the requestInvalidEmailException
- if the email is invalid
-