Fix tests and profile picture
This commit is contained in:
@@ -19,7 +19,6 @@ import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -168,23 +167,23 @@ public class UserController {
|
||||
content = @Content(mediaType = "application/json"))
|
||||
})
|
||||
@PutMapping("/setProfilePicture/{id}")
|
||||
public ResponseEntity<Void> setProfilePicture(@RequestParam MultipartFile profilePicture,
|
||||
public ResponseEntity<Void> setProfilePicture(@RequestParam String base64ProfilePicture,
|
||||
@PathVariable @NotNull Long id) {
|
||||
this.userService.setProfilePicture(id, profilePicture);
|
||||
this.userService.setProfilePicture(id, base64ProfilePicture);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@Operation(summary = "Get the profile Picture of the user.", description = "A user can get their displayed profile picture.")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "Profile picture successfully retrieved",
|
||||
content = @Content(mediaType = "image/jpeg")),
|
||||
content = @Content(mediaType = "application/json")),
|
||||
@ApiResponse(responseCode = "304", description = "Profile picture not modified since last request"),
|
||||
@ApiResponse(responseCode = "403", description = "Only authorized persons may see the profiles picture"),
|
||||
@ApiResponse(responseCode = "404", description = "The user does not exist")
|
||||
})
|
||||
@GetMapping("/getProfilePicture/{id}")
|
||||
public ResponseEntity<byte[]> getProfilePicture(@PathVariable @NotNull Long id) {
|
||||
byte[] imageData = userService.getProfilePicture(id);
|
||||
public ResponseEntity<String> getProfilePicture(@PathVariable @NotNull Long id) {
|
||||
String imageData = userService.getProfilePicture(id);
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.IMAGE_JPEG)
|
||||
|
||||
Reference in New Issue
Block a user