Package com.dzidzi.api
Interface RestaurantApi
public interface RestaurantApi
RestaurantApi contains all the api operations handling
Restaurant in the DzidziApp.-
Method Summary
Modifier and TypeMethodDescriptionaddRestaurantBranch(AddBranchRequest addBranchRequest) Adds/creates a new restaurant branch.com.dzidzi.job.dto.JobbulkAddBranchJob(com.dzidzi.job.restaurant.BulkAddRestaurantParameter bulkAddRestaurantParameter) Adds/creates a bulk restaurant branch by the restaurant admin.createRestaurant(AddRestaurantRequest addRestaurantRequest, String verificationCode) Adds/creates a new restaurant.voiddeactivateAccount(UUID restaurantId) Deactivates the restaurant account by the given id.com.dzidzi.job.dto.JobdisableRestaurantsVisibilityJob(List<UUID> restaurantIds, boolean allEnabledRestaurants) An async job triggered by the restaurant admin to disable the visibility of branch restaurants.editRestaurant(ChangeRestaurantRequest changeRestaurantRequest) Changes a field/all fields of an existing restaurant.com.dzidzi.job.dto.JobenableRestaurantsVisibilityJob(List<UUID> restaurantIds, boolean allDisabledRestaurants) An async job triggered by the restaurant admin to enable the visibility of branch restaurants.voidenableVisibility(UUID restaurantId) Enables the visibility of restaurant to users.findChildrenRestaurants(UUID restaurantId) Finds all the branch restaurants of the given parent restaurant id.findRestaurantByCredentialId(UUID credentialId) Finds a restaurant by credential id.findRestaurantByEmail(String email) Finds a restaurant by email.findRestaurantById(UUID restaurantId) Finds a restaurant by id.findRestaurantByIdWithoutError(UUID restaurantId) Finds a restaurant by restaurant id without error.findRestaurants(FindRestaurantRequest findRestaurantRequest) The paged results of the provided request.byte[]generateExcelFile(String value) Finds all the branch restaurants of the current parent restaurant.voidreactivateAccount(String email) An email is sent to verify the user and activates the account.voidremoveAccount(UUID restaurantId) Removes a restaurant from the system by an admin.com.dzidzi.job.dto.JobremoveBranchRestaurantJob(List<UUID> branchIds) An async job that is triggered by the restaurant admin to remove all its branches if branchIds are empty or selected branches.com.dzidzi.job.dto.JobremoveParentRestaurantJob(UUID parentRestaurantId) An async job that is triggered by the admin of the application to remove a parent restaurant and its branches.voiduploadImage(org.springframework.web.multipart.MultipartFile avatar, org.springframework.web.multipart.MultipartFile backgroundImage)
-
Method Details
-
findRestaurantById
Finds a restaurant by id.- Parameters:
restaurantId- the restaurant id- Returns:
- the restaurant found
- Throws:
com.dzidzi.exception.EntityNotFoundException- when the restaurant is not found
-
findRestaurantByCredentialId
Finds a restaurant by credential id.- Parameters:
credentialId- the credential id- Returns:
- the restaurant found
-
findRestaurantByIdWithoutError
Finds a restaurant by restaurant id without error.- Parameters:
restaurantId- the credential id- Returns:
- the restaurant found
-
createRestaurant
Adds/creates a new restaurant. To be able to create a new restaurant, credential is needed. SeeCredentialApi.addNewUserCredentialByAdmin(String, UserRole)on how to create credential.- Parameters:
addRestaurantRequest- theAddRestaurantRequestcontaining the properties to create/add a new restaurantverificationCode- the user verification code- Returns:
- the restaurant created/added
- Throws:
com.dzidzi.exception.DzidziException- when image is unable to upload to the cloud
-
addRestaurantBranch
Adds/creates a new restaurant branch. To be able to create a new restaurant bra, credential is needed. SeeCredentialApi.addNewUserCredentialByAdmin(String, UserRole)on how to create credential.- Parameters:
addBranchRequest- theAddBranchRequestcontaining the properties to create/add a new restaurant branch- Returns:
- the branch restaurant created/added
- Throws:
com.dzidzi.exception.DzidziException- when image is unable to upload to the cloud
-
editRestaurant
Changes a field/all fields of an existing restaurant.- Parameters:
changeRestaurantRequest- theChangeRestaurantRequestto change an existing restaurant- Returns:
- the updated restaurant
- Throws:
com.dzidzi.exception.DzidziException- when image is unable to load
-
uploadImage
void uploadImage(org.springframework.web.multipart.MultipartFile avatar, org.springframework.web.multipart.MultipartFile backgroundImage) -
findRestaurantByEmail
Finds a restaurant by email.- Parameters:
email- the restaurant email- Returns:
- the restaurant found
-
getCurrentRestaurant
Restaurant getCurrentRestaurant() -
removeAccount
Removes a restaurant from the system by an admin. -
deactivateAccount
Deactivates the restaurant account by the given id.- Parameters:
restaurantId- the restaurant id to deactivate
-
reactivateAccount
An email is sent to verify the user and activates the account.- Parameters:
email- the email of the deactivated account
-
enableVisibility
Enables the visibility of restaurant to users.- Parameters:
restaurantId- the id of the restaurant
-
bulkAddBranchJob
com.dzidzi.job.dto.Job bulkAddBranchJob(com.dzidzi.job.restaurant.BulkAddRestaurantParameter bulkAddRestaurantParameter) Adds/creates a bulk restaurant branch by the restaurant admin.- Parameters:
bulkAddRestaurantParameter- theBulkAddRestaurantParametercontaining the information of an Excel file which has rows and columns(properties) to create/add a bulk restaurant branch- Returns:
- the
Job - Throws:
com.dzidzi.exception.DzidziException- when image is unable to upload to the cloud
-
removeBranchRestaurantJob
An async job that is triggered by the restaurant admin to remove all its branches if branchIds are empty or selected branches.- Parameters:
branchIds- ids of the restaurant branch ids. When empty, all branches are removed.- Returns:
- the
Job
-
removeParentRestaurantJob
An async job that is triggered by the admin of the application to remove a parent restaurant and its branches.- Parameters:
parentRestaurantId- the parent restaurant id- Returns:
- the
Job
-
enableRestaurantsVisibilityJob
com.dzidzi.job.dto.Job enableRestaurantsVisibilityJob(List<UUID> restaurantIds, boolean allDisabledRestaurants) An async job triggered by the restaurant admin to enable the visibility of branch restaurants.- Parameters:
restaurantIds- the restaurant ids to enableallDisabledRestaurants- a flag when true enable the visibility of all disabled branch restaurants regardless of the given restaurantIds- Returns:
- the
Job
-
disableRestaurantsVisibilityJob
com.dzidzi.job.dto.Job disableRestaurantsVisibilityJob(List<UUID> restaurantIds, boolean allEnabledRestaurants) An async job triggered by the restaurant admin to disable the visibility of branch restaurants.- Parameters:
restaurantIds- the restaurant ids to enableallEnabledRestaurants- a flag when true disables the visibility of all enabled branch restaurants regardless of the given restaurantIds- Returns:
- the
Job
-
findRestaurants
The paged results of the provided request.- Parameters:
findRestaurantRequest- the request used for filtering restaurants- Returns:
- the
DzidziPaginationDTO
-
findChildrenRestaurants
Finds all the branch restaurants of the given parent restaurant id.- Parameters:
restaurantId- the parent restaurant id- Returns:
- list of branch restaurants
-
getCurrentRestaurantBranches
List<Restaurant> getCurrentRestaurantBranches()Finds all the branch restaurants of the current parent restaurant.- Returns:
- list of branch restaurants
-
generateExcelFile
-