[R4] Only find the active doctors

This commit is contained in:
Mirna Gama 2024-01-05 18:40:35 -03:00 committed by Mirna Gama
parent 34071ec1d8
commit bbde76cedc
2 changed files with 5 additions and 2 deletions

View File

@ -27,10 +27,10 @@ public class FindDoctorsUseCase {
*
* @param pageable Pagination information, such as size and page number
*
* @return A paginated list with stored doctors if successful, or null if there is an error
* @return A paginated list with active stored doctors if successful, or null if there is an error
*
*/
public Page<Doctor> execute(Pageable pageable) {
return this.doctorRepository.findAll(pageable);
return this.doctorRepository.findDoctorsByActiveTrue(pageable);
}
}

View File

@ -1,5 +1,7 @@
package com.mirna.hospitalmanagementapi.domain.repositories;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import com.mirna.hospitalmanagementapi.domain.entities.Doctor;
@ -12,4 +14,5 @@ import com.mirna.hospitalmanagementapi.domain.entities.Doctor;
*/
public interface DoctorRepository extends JpaRepository<Doctor, Long> {
Page<Doctor> findDoctorsByActiveTrue(Pageable pageable);
}