Interface ExtraApi


public interface ExtraApi
ExtraApi contains all the api operations handling Extra in the DzidziApp.
  • Method Details

    • findExtraById

      Extra findExtraById(UUID extraId)
      Finds an extra by id.
      Parameters:
      extraId - the id of the extra
      Returns:
      the extra found
      Throws:
      com.dzidzi.exception.EntityNotFoundException - when the extra is not found
    • createExtra

      Extra createExtra(AddExtraRequest addExtraRequest)
      Adds/create a new extra by the logged in restaurant user.
      Parameters:
      addExtraRequest - the AddExtraRequest containing the properties to create/add a new extra
      Returns:
      the extra created/added
      Throws:
      com.dzidzi.exception.DzidziException - when image is unable to load
    • editExtra

      Extra editExtra(ChangeExtraRequest changeExtraRequest)
      Changes a field/all fields of an existing extra.
      Parameters:
      changeExtraRequest - the ChangeExtraRequest containing the properties to change the existing extra
      Returns:
      the updated extra
      Throws:
      com.dzidzi.exception.DzidziException - when image is unable to load
    • deleteExtra

      void deleteExtra(UUID extraId)
      Removes an extra by extra id and logged in restaurant. You can only delete a restaurant only if you are logged in as either UserRole.RESTAURANT_ADMIN or UserRole.RESTAURANT_BRANCH and the extra belongs to the logged in restaurant.
      Parameters:
      extraId - the id of the extra
    • bulkAddExtra

      com.dzidzi.job.dto.Job bulkAddExtra(com.dzidzi.job.dto.ExtraJobRequest extraJobRequest)
      An async job is triggered to make bulk addition of extras
      Parameters:
      extraJobRequest - the request body
      Returns:
      the Job
    • enableExtraVisibility

      void enableExtraVisibility(UUID extraId)
      An extra is enabled to be visible by users.
      Parameters:
      extraId - the extra id to enable
    • disableExtraVisibility

      void disableExtraVisibility(UUID extraId)
      An extra is disabled to be invisible to users.
      Parameters:
      extraId - the extra id to disable
    • enableExtraVisibilityJob

      com.dzidzi.job.dto.Job enableExtraVisibilityJob(List<UUID> extraIds)
      An async job that enables the visibility of bulk extras to users.
      Parameters:
      extraIds - the extra ids to enable
      Returns:
      the Job
    • disableExtraVisibilityJob

      com.dzidzi.job.dto.Job disableExtraVisibilityJob(List<UUID> extraIds)
      An async job that disabled the visibility of bulk extras to users.
      Parameters:
      extraIds - the extra ids to disable
      Returns:
      the Job
    • findExtras

      DzidziPaginationDTO<Extra> findExtras(FindExtraRequest findExtraRequest)
      The paged results of the provided request.
      Parameters:
      findExtraRequest - the requests used for filtering extras
      Returns:
      the DzidziPaginationDTO