MME-8 Add image view endpoint.
This commit is contained in:
parent
85fa18925a
commit
ba40c48719
@ -80,6 +80,19 @@ public class ImageController {
|
|||||||
.body(new InputStreamResource(imageInputStream));
|
.body(new InputStreamResource(imageInputStream));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{username}/{filename}/view")
|
||||||
|
public ResponseEntity<ImageView> getImageView(
|
||||||
|
@AuthenticationPrincipal User principal,
|
||||||
|
@PathVariable String username,
|
||||||
|
@PathVariable String filename
|
||||||
|
) {
|
||||||
|
final User owner = this.userService.getUser(username);
|
||||||
|
final Image image = this.imageService.getByOwnerAndFilename(owner, filename, principal);
|
||||||
|
return ResponseEntity.ok(
|
||||||
|
this.imageToViewConverter.convert(image, principal, false)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public ResponseEntity<ImageView> uploadImage(
|
public ResponseEntity<ImageView> uploadImage(
|
||||||
@RequestParam MultipartFile image,
|
@RequestParam MultipartFile image,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user