dev #1

Merged
Guams merged 2 commits from dev into master 2025-06-18 09:58:15 +02:00
2 changed files with 3 additions and 1 deletions
Showing only changes of commit 4a06b45020 - Show all commits

View File

@ -36,6 +36,7 @@ public class SpringSecurityConfig {
.requestMatchers(HttpMethod.GET, .requestMatchers(HttpMethod.GET,
"/api/authors", "/api/authors",
"/api/authors/{id}", "/api/authors/{id}",
"/api/authors/{id}/avatar",
"/api/authors/{id}/posts", "/api/authors/{id}/posts",
"/api/posts", "/api/posts",
"/api/posts/{id}", "/api/posts/{id}",

View File

@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;
import java.util.Base64;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@ -76,7 +77,7 @@ public class AuthorController {
@GetMapping("/{id}/avatar") @GetMapping("/{id}/avatar")
public byte[] getProfilePicture(@PathVariable UUID id) { public byte[] getProfilePicture(@PathVariable UUID id) {
Author author = authorService.findById(id).orElseThrow(() -> new NotFoundException("Author not found")); Author author = authorService.findById(id).orElseThrow(() -> new NotFoundException("Author not found"));
return author.getProfilePicture(); return Base64.getEncoder().encode(author.getProfilePicture());
} }
@DeleteMapping("/{id}") @DeleteMapping("/{id}")