Class FirebaseService

java.lang.Object
restapi.services.FirebaseService

@Service public class FirebaseService extends Object
  • Field Details

    • userRepository

      @NonNull private final @NonNull UserRepository userRepository
  • Constructor Details

    • FirebaseService

      public FirebaseService()
  • Method Details

    • getPhoneFromFireAuth

      private String getPhoneFromFireAuth(String authUID) throws CustomNotFoundException
      Retrieves phone number corresponding to auth UID from Firebase
      Parameters:
      authUID - Firebase authUID corresponding to a user logged with phone
      Returns:
      Phone number in format String
      Throws:
      CustomNotFoundException - When Firebase rejects the authUID
    • getUsernameByFireAuth

      public String getUsernameByFireAuth(String authUID) throws CustomNotFoundException
      Returns Username with phone number corresponding to the authUID on Firebase
      Parameters:
      authUID - Firebase authUID corresponding to a user logged with phone
      Returns:
      Username
      Throws:
      CustomNotFoundException - When Firebase rejects the authUID or Phone Number not found in database
    • getValidPhoneFromFireAuth

      public String getValidPhoneFromFireAuth(String authUID) throws CustomNotFoundException, CustomConflictException
      Returns phone number corresponding to the authUID on Firebase if the phone is not already used by a user
      Parameters:
      authUID - Firebase authUID corresponding to a user logged with phone
      Returns:
      Phone Number in format String if it is not on the database
      Throws:
      CustomNotFoundException - When Firebase rejects the authUID
      CustomConflictException - When Phone Number already in database