Class UserService

java.lang.Object
com.coachconnect.auth.UserService

public class UserService extends Object
Service for user-related operations.
  • Constructor Details

    • UserService

      public UserService()
      Constructor initializing dependencies.
    • UserService

      public UserService(DatabaseManager dbManager)
  • Method Details

    • processGoogleAuth

      public Result<User,String> processGoogleAuth(String code)
      Processes a Google OAuth code and returns the authenticated user.
      Parameters:
      code - The authorization code
      Returns:
      A Result containing the user or an error message
    • getUserInfo

      public User getUserInfo(String accessToken) throws IOException
      Gets user information from Google using an access token.
      Parameters:
      accessToken - The access token
      Returns:
      The user information
      Throws:
      IOException - If an error occurs
    • getUserById

      public Result<User,String> getUserById(String userId)
      Gets a user by ID.
      Parameters:
      userId - The user ID
      Returns:
      A Result containing the user or an error message
    • updateUserRole

      public Result<User,String> updateUserRole(String userId, UserRole role)
      Updates a user's role.
      Parameters:
      userId - The user ID
      role - The new role
      Returns:
      A Result containing the updated user or an error message