Implemented User Profilepicture | PLEASE check again if implemented right

This commit is contained in:
2026-01-21 02:28:38 +01:00
parent d92b71179a
commit 159c03142a
6 changed files with 124 additions and 0 deletions
@@ -17,6 +17,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@Validated
@RestController
@@ -141,4 +142,24 @@ public class UserController {
this.userService.setVisibilityPrivacy(visibilityPrivacy);
return ResponseEntity.ok().build();
}
@Operation(summary = "Add a profile Picture to the user.", description = "A user can add or update a profile picture to be displayed on his profile.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Profile picture successfully added/updated",
content = @Content(mediaType = "application/json")),
@ApiResponse(responseCode = "400", description = "Invalid input data",
content = @Content(mediaType = "application/json")),
@ApiResponse(responseCode = "403", description = "Only authorized persons may add/update the profile picture",
content = @Content(mediaType = "application/json")),
@ApiResponse(responseCode = "404", description = "The user does not exist",
content = @Content(mediaType = "application/json"))
})
@PutMapping("/setProfilePicture/{id}")
public ResponseEntity<Void> setProfilePicture(@RequestParam MultipartFile profilePicture,
@PathVariable @NotNull Long id) {
this.userService.setProfilePicture(id, profilePicture);
return ResponseEntity.ok().build();
}
}