basic feed

This commit is contained in:
Stepan Usatiuk
2023-12-17 12:17:45 +01:00
parent d752d20d92
commit b4fa821d0d
8 changed files with 91 additions and 30 deletions

View File

@@ -47,12 +47,12 @@ public class PostController {
@GetMapping(path = "/by-author-username")
public Stream<PostTo> readAllByAuthorUsername(@RequestParam Optional<String> author) {
if (author.isPresent())
return postService.readByAuthorId(author.get()).stream().map(PostMapper::makeDto);
return postService.readByAuthorUsername(author.get()).stream().map(PostMapper::makeDto);
else
throw new ResponseStatusException(HttpStatus.BAD_REQUEST);
}
@GetMapping(path = "/following")
@GetMapping(path = "/by-following")
public Stream<PostTo> readAllByFollowees(Principal principal) {
return postService.readByPersonFollowees(principal.getName()).stream().map(PostMapper::makeDto);
}