Class UserController
java.lang.Object
com.example.blogs.app.api.user.controller.UserController
REST API endpoints for user profile operations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetUserByUsername(String username) Retrieves complete user profile including posts by username.updateUserProfile(UserPrincipal userPrincipal, @Valid UpdateUserRequestDTO requestDTO, MultipartFile profilePicture) Updates the authenticated user's profile information and optionally their profile picture.
-
Constructor Details
-
UserController
public UserController()
-
-
Method Details
-
getUserByUsername
@GetMapping("/{username}") public ResponseEntity<UserDTO> getUserByUsername(@PathVariable String username) Retrieves complete user profile including posts by username.- Parameters:
username- path variable containing the username- Returns:
- HTTP 200 with user profile and post summaries
- Throws:
UserNotFoundException- if user is not found
-
updateUserProfile
@PatchMapping(path="/me", consumes="multipart/form-data") public ResponseEntity<UpdateUserResponseDTO> updateUserProfile(@AuthenticationPrincipal UserPrincipal userPrincipal, @NotNull @Valid @RequestPart("user") @Valid UpdateUserRequestDTO requestDTO, @RequestPart(value="profilePicture",required=false) MultipartFile profilePicture) Updates the authenticated user's profile information and optionally their profile picture.- Parameters:
userPrincipal- the authenticated user's principal containing user detailsrequestDTO- the request DTO containing fields to update (e.g., name, bio)profilePicture- optional multipart file for the new profile picture- Returns:
- HTTP 200 with the updated user profile information
-