Package com.coachconnect.auth
Class UserService
java.lang.Object
com.coachconnect.auth.UserService
Service for user-related operations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classGoogle user information class. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor initializing dependencies.UserService(DatabaseManager dbManager) -
Method Summary
Modifier and TypeMethodDescriptiongetUserById(String userId) Gets a user by ID.getUserInfo(String accessToken) Gets user information from Google using an access token.processGoogleAuth(String code) Processes a Google OAuth code and returns the authenticated user.updateUserRole(String userId, UserRole role) Updates a user's role.
-
Constructor Details
-
UserService
public UserService()Constructor initializing dependencies. -
UserService
-
-
Method Details
-
processGoogleAuth
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
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
Gets a user by ID.- Parameters:
userId- The user ID- Returns:
- A Result containing the user or an error message
-
updateUserRole
Updates a user's role.- Parameters:
userId- The user IDrole- The new role- Returns:
- A Result containing the updated user or an error message
-