Package com.dzidzi.api
Interface UserApi
public interface UserApi
UserApi contains all the api operations handling
User in the DzidziApp.
This is the customer Api.-
Method Summary
Modifier and TypeMethodDescriptionvoidactivateAccount(String verificationCode) Activates user account.voidactivateAccountAfterDeactivation(String verificationCode, String password, String repeatedPassword) This reactivates user account after account has been deactivated.createUserAccount(AddUserRequest addUserRequest) Adds/creates a new user.voidDeactivates logged-in user accounteditUserParameters(ChangeUserRequest changeUserRequest) Changes the fields/all fields of an existing user.booleanemailExists(String email) Checks if the given email already exists for a user with user role.findUserById(UUID userId) Finds a user by id.findUsers(FindUserRequest findUserRequest) Finds the paginated users based on the request.voidreactivateAccount(String email) Reactivate account.voidRemoves a user account from the system by the logged-in user.
-
Method Details
-
findUserById
Finds a user by id.- Parameters:
userId- the user id- Returns:
- the user found
- Throws:
com.dzidzi.exception.EntityNotFoundException- when the user is not found
-
createUserAccount
Adds/creates a new user.- Parameters:
addUserRequest- theAddUserRequestto create/add a new user- Returns:
- the newly created user
-
editUserParameters
Changes the fields/all fields of an existing user. The user id is obtained from theSecurityContextHolder, that is a user can edit their information only when logged in.- Parameters:
changeUserRequest- theChangeUserRequestcontaining the fields to change- Returns:
- the updated user
-
getUserByCredentialId
User getUserByCredentialId() -
removeAccount
void removeAccount()Removes a user account from the system by the logged-in user. -
activateAccount
Activates user account.- Parameters:
verificationCode- the verification code of the user to be activated
-
deactivateAccount
void deactivateAccount()Deactivates logged-in user account -
reactivateAccount
Reactivate account.- Parameters:
email- user email
-
activateAccountAfterDeactivation
void activateAccountAfterDeactivation(String verificationCode, String password, String repeatedPassword) This reactivates user account after account has been deactivated. User has to set a new password to reactivate account.- Parameters:
verificationCode- the verification codepassword- the new passwordrepeatedPassword- the repeated password
-
findUsers
Finds the paginated users based on the request.- Parameters:
findUserRequest- the request containing the params to filter users on- Returns:
- the
DzidziPaginationDTO
-
emailExists
Checks if the given email already exists for a user with user role.- Parameters:
email- the email- Returns:
- true is email exist, false otherwise
-