Implemented User Profilepicture | PLEASE check again if implemented right
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user