added filter on title and description on post

This commit is contained in:
SlimusMinus
2026-07-06 00:47:07 +03:00
parent 04f29001ac
commit 97f28b9eca
6 changed files with 84 additions and 69 deletions

View File

@@ -11,6 +11,10 @@ import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
import org.springframework.http.MediaType;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.DeleteMapping;
@@ -44,8 +48,10 @@ public class PostController {
}
@GetMapping
public List<PostResponse> getFeed() {
return service.getFeed();
public Page<PostResponse> getFeed(
@RequestParam(required = false) String search,
@PageableDefault(size = 20, sort = "createdAt", direction = Sort.Direction.DESC) Pageable pageable) {
return service.getFeed(search, pageable);
}
@GetMapping("/{id}")