Interface RestaurantApi


public interface RestaurantApi
RestaurantApi contains all the api operations handling Restaurant in the DzidziApp.
  • Method Details

    • findRestaurantById

      Restaurant findRestaurantById(UUID restaurantId)
      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

      Restaurant findRestaurantByCredentialId(UUID credentialId)
      Finds a restaurant by credential id.
      Parameters:
      credentialId - the credential id
      Returns:
      the restaurant found
    • findRestaurantByIdWithoutError

      Restaurant findRestaurantByIdWithoutError(UUID restaurantId)
      Finds a restaurant by restaurant id without error.
      Parameters:
      restaurantId - the credential id
      Returns:
      the restaurant found
    • createRestaurant

      Restaurant createRestaurant(AddRestaurantRequest addRestaurantRequest, String verificationCode)
      Adds/creates a new restaurant. To be able to create a new restaurant, credential is needed. See CredentialApi.addNewUserCredentialByAdmin(String, UserRole) on how to create credential.
      Parameters:
      addRestaurantRequest - the AddRestaurantRequest containing the properties to create/add a new restaurant
      verificationCode - the user verification code
      Returns:
      the restaurant created/added
      Throws:
      com.dzidzi.exception.DzidziException - when image is unable to upload to the cloud
    • addRestaurantBranch

      Restaurant addRestaurantBranch(AddBranchRequest addBranchRequest)
      Adds/creates a new restaurant branch. To be able to create a new restaurant bra, credential is needed. See CredentialApi.addNewUserCredentialByAdmin(String, UserRole) on how to create credential.
      Parameters:
      addBranchRequest - the AddBranchRequest containing 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

      Restaurant editRestaurant(ChangeRestaurantRequest changeRestaurantRequest)
      Changes a field/all fields of an existing restaurant.
      Parameters:
      changeRestaurantRequest - the ChangeRestaurantRequest to 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

      Restaurant findRestaurantByEmail(String email)
      Finds a restaurant by email.
      Parameters:
      email - the restaurant email
      Returns:
      the restaurant found
    • getCurrentRestaurant

      Restaurant getCurrentRestaurant()
    • removeAccount

      void removeAccount(UUID restaurantId)
      Removes a restaurant from the system by an admin.
    • deactivateAccount

      void deactivateAccount(UUID restaurantId)
      Deactivates the restaurant account by the given id.
      Parameters:
      restaurantId - the restaurant id to deactivate
    • reactivateAccount

      void reactivateAccount(String email)
      An email is sent to verify the user and activates the account.
      Parameters:
      email - the email of the deactivated account
    • enableVisibility

      void enableVisibility(UUID restaurantId)
      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 - the BulkAddRestaurantParameter containing 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

      com.dzidzi.job.dto.Job removeBranchRestaurantJob(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.
      Parameters:
      branchIds - ids of the restaurant branch ids. When empty, all branches are removed.
      Returns:
      the Job
    • removeParentRestaurantJob

      com.dzidzi.job.dto.Job removeParentRestaurantJob(UUID parentRestaurantId)
      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 enable
      allDisabledRestaurants - 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 enable
      allEnabledRestaurants - a flag when true disables the visibility of all enabled branch restaurants regardless of the given restaurantIds
      Returns:
      the Job
    • findRestaurants

      DzidziPaginationDTO<Restaurant> findRestaurants(FindRestaurantRequest findRestaurantRequest)
      The paged results of the provided request.
      Parameters:
      findRestaurantRequest - the request used for filtering restaurants
      Returns:
      the DzidziPaginationDTO
    • findChildrenRestaurants

      List<Restaurant> findChildrenRestaurants(UUID restaurantId)
      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

      byte[] generateExcelFile(String value)