Class UserController

java.lang.Object
com.example.blogs.app.api.user.controller.UserController

@RestController @RequestMapping("/users") public class UserController extends Object
REST API endpoints for user profile operations.
  • 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 details
      requestDTO - 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