Interface CourierApi


public interface CourierApi
CourierApi contains all the api operations handling Courier in the DzidziApp.
  • Method Details

    • findCourierById

      Courier findCourierById(UUID courierId)
      Finds a courier by the given id.
      Parameters:
      courierId - the id of the courier
      Returns:
      the courier found
      Throws:
      com.dzidzi.exception.EntityNotFoundException - when the courier is not found
    • createCourier

      Courier createCourier(AddCourierRequest addCourierRequest, String verificationCode)
      Adds/creates a new courier. To be able to create a new courier, credential is needed. See CredentialApi.addNewUserCredentialByAdmin(String, UserRole) on how to create credential.
      Parameters:
      addCourierRequest - the AddCourierRequest to create/add a new courier
      verificationCode - the verification code of the user
      Returns:
      the courier created/added
    • editCourier

      Courier editCourier(ChangeCourierRequest changeCourierRequest)
      Changes a field/all fields of an existing courier.
      Parameters:
      changeCourierRequest - the ChangeCourierRequest to change an existing courier
      Returns:
      the updated courier
    • uploadAvatar

      void uploadAvatar(org.springframework.web.multipart.MultipartFile image)
    • findCourierByAvailability

      List<Courier> findCourierByAvailability()
      Finds the list of courier by CourierStatus.ONLINE. online.
      Returns:
      the list of couriers found
    • findCourierVerificationCode

      Courier findCourierVerificationCode(String verificationCode)
      Finds the courier by verification code.
      Parameters:
      verificationCode - the verification code of the courier
      Returns:
      the courier found
    • getCurrentCourier

      Courier getCurrentCourier()
      Gets the logged in courier details.
      Returns:
      the logged in courier
    • findCouriers

      DzidziPaginationDTO<Courier> findCouriers(FindCourierRequest findCourierRequest)
      The paged results of the provided request.
      Parameters:
      findCourierRequest - the requests used for filtering couriers
      Returns:
      the DzidziPaginationDTO
    • removeAccount

      void removeAccount(UUID courierId)
      Removes a courier account from the system by an admin.
    • changeAvailability

      void changeAvailability(boolean availability)
      Changes the couriers' availability. If it's true, that means the courier is online otherwise offline.
      Parameters:
      availability - true/false
    • deactivateAccountByAdmin

      void deactivateAccountByAdmin(UUID courierId)
      Deactivates courier account by the given courier id
      Parameters:
      courierId - the courier id