Fix all Tests
LocationBasedServices/sumoc-backend/pipeline/head This commit looks good

This commit is contained in:
2026-01-22 13:40:26 +01:00
parent 917ed77a95
commit 8e4d6bf820
6 changed files with 81 additions and 3 deletions
@@ -15,6 +15,7 @@ import jakarta.validation.constraints.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.CacheControl;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -173,4 +174,21 @@ public class UserController {
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")),
@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);
return ResponseEntity.ok()
.contentType(MediaType.IMAGE_JPEG)
.cacheControl(CacheControl.maxAge(365, TimeUnit.DAYS))
.body(imageData);
}
}