Correction of route /api/posts/last from lazy relations.

This commit is contained in:
2019-01-23 22:19:06 +01:00
parent cff738b91a
commit 55940c5fe7
2 changed files with 6 additions and 4 deletions
@@ -18,6 +18,7 @@ import org.codiki.core.repositories.PostRepository;
import org.codiki.core.services.ParserService;
import org.codiki.core.services.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@@ -78,7 +79,7 @@ public class PostController {
@GetMapping("/last")
public List<PostDTO> getLast() {
return postRepository.getLast(LIMIT_POSTS_HOME).stream()
return postRepository.getLast(PageRequest.of(0, LIMIT_POSTS_HOME)).stream()
.map(PostDTO::new).collect(Collectors.toList());
}