[R2] Pageable default value

This commit is contained in:
Mirna Gama 2024-01-04 18:08:50 -03:00 committed by Mirna Gama
parent bc8a6b3ba2
commit 36b2a47c3f

View File

@ -5,6 +5,7 @@ import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -58,7 +59,7 @@ public class DoctorController {
* @return A response entity containing the paginated sublist of doctors if successful
*/
@GetMapping
public ResponseEntity<Object> getDoctors(Pageable pageable) {
public ResponseEntity<Object> getDoctors(@PageableDefault(size = 10, sort = {"name"}) Pageable pageable) {
Page<DoctorPublicDataDTO> doctors = doctorService.findDoctors(pageable);