Interface UserPhoneRepository

All Known Implementing Classes:
JdbcUserPhoneRepository

public interface UserPhoneRepository
Port that stores the verified phone number of each user. An implementation never returns null.
  • Method Details

    • findByUserId

      Optional<UserPhone> findByUserId(UUID userId)
      Finds the verified phone of a user.
      Parameters:
      userId - identifier of the user.
      Returns:
      the phone, or empty when the user has none.
    • findByPhone

      Optional<UserPhone> findByPhone(PhoneNumber phone)
      Finds the verified phone that holds a number.
      Parameters:
      phone - the number.
      Returns:
      the phone, or empty when no user verified it.
    • save

      boolean save(UserPhone phone)
      Stores the verified phone of a user, replacing the one it had.
      Parameters:
      phone - the verified phone.
      Returns:
      false when another user already holds the number and nothing was stored.
    • deleteByUserId

      void deleteByUserId(UUID userId)
      Removes the verified phone of a user.
      Parameters:
      userId - identifier of the user.