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 Summary
Modifier and TypeMethodDescriptionvoiddeleteByUserId(UUID userId) Removes the verified phone of a user.findByPhone(PhoneNumber phone) Finds the verified phone that holds a number.findByUserId(UUID userId) Finds the verified phone of a user.booleanStores the verified phone of a user, replacing the one it had.
-
Method Details
-
findByUserId
Finds the verified phone of a user.- Parameters:
userId- identifier of the user.- Returns:
- the phone, or empty when the user has none.
-
findByPhone
Finds the verified phone that holds a number.- Parameters:
phone- the number.- Returns:
- the phone, or empty when no user verified it.
-
save
Stores the verified phone of a user, replacing the one it had.- Parameters:
phone- the verified phone.- Returns:
falsewhen another user already holds the number and nothing was stored.
-
deleteByUserId
Removes the verified phone of a user.- Parameters:
userId- identifier of the user.
-