[R4] Deactivate doctors method in service class

This commit is contained in:
Mirna Gama 2024-01-05 18:41:07 -03:00 committed by Mirna Gama
parent bbde76cedc
commit 83ca208352
2 changed files with 27 additions and 0 deletions

View File

@ -127,4 +127,23 @@ public class DoctorServiceImpl implements DoctorService {
}
/**
* Deactivates an existing doctor record by provided id
* @param id Long that represents the doctor's unique identifier
*
* @return The deactivated doctor if successful, or null if there is an error.
*/
@Override
public Doctor deactivateDoctor(Long id) {
Doctor doctor = findDoctorById.execute(id);
if (doctor != null) {
doctor.setActive(false);
return saveDoctor.execute(doctor);
}
return null;
}
}

View File

@ -43,4 +43,12 @@ public interface DoctorService {
* @return The updated doctor if successful, or null if there is an error.
*/
public Doctor updateDoctor(DoctorUpdatedDataDTO doctorUpdatedDataDTO);
/**
* Deactivates an existing doctor record by provided id
* @param id Long that represents the doctor's unique identifier
*
* @return The deactivated doctor if successful, or null if there is an error.
*/
public Doctor deactivateDoctor(Long id);
}