MME-8 Add image view endpoint.

This commit is contained in:
Jesse Brault 2026-02-06 23:27:18 -06:00
parent 85fa18925a
commit ba40c48719

View File

@ -80,6 +80,19 @@ public class ImageController {
.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
public ResponseEntity<ImageView> uploadImage(
@RequestParam MultipartFile image,