added filter on title and description on post
This commit is contained in:
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user