[R9] Find consultation by doctor or patient and date use case classes
This commit is contained in:
parent
7ba358eb58
commit
b0fc5bf648
@ -0,0 +1,34 @@
|
||||
package com.mirna.hospitalmanagementapi.application.usecase.consultation;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.mirna.hospitalmanagementapi.domain.entities.Consultation;
|
||||
import com.mirna.hospitalmanagementapi.domain.repositories.ConsultationRepository;
|
||||
|
||||
/**
|
||||
* This class is used to execute the findConsultationByDoctorAndDate method from consultation repository
|
||||
*
|
||||
* @author Mirna Gama
|
||||
* @version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class FindConsultationByDoctorAndDateUseCase {
|
||||
|
||||
@Autowired
|
||||
private ConsultationRepository consultationRepository;
|
||||
|
||||
/**
|
||||
* Executes the findConsultationByDoctorAndDate method from Doctor repository
|
||||
*
|
||||
* @param doctorId The doctor's id from the consultation
|
||||
* @param consultationDate The date of the consultation
|
||||
* @return The corresponding consultation if successful, or null if it is non-existent
|
||||
*
|
||||
*/
|
||||
public Consultation execute(Long doctorId, LocalDateTime consultationDate) {
|
||||
return this.consultationRepository.findConsultationByDoctorAndDate(doctorId, consultationDate);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.mirna.hospitalmanagementapi.application.usecase.consultation;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.mirna.hospitalmanagementapi.domain.entities.Consultation;
|
||||
import com.mirna.hospitalmanagementapi.domain.repositories.ConsultationRepository;
|
||||
|
||||
/**
|
||||
* This class is used to execute the findConsultationByPatientAndDate method from consultation repository
|
||||
*
|
||||
* @author Mirna Gama
|
||||
* @version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class FindConsultationByPatientAndDateUseCase {
|
||||
|
||||
@Autowired
|
||||
private ConsultationRepository consultationRepository;
|
||||
|
||||
/**
|
||||
* Executes the findConsultationByPatientAndDate method from Doctor repository
|
||||
*
|
||||
* @param patientId The patient's id from the consultation
|
||||
* @param consultationDate The date of the consultation
|
||||
* @return The corresponding consultation if successful, or null if it is non-existent
|
||||
*
|
||||
*/
|
||||
public Consultation execute(Long patientId, LocalDateTime consultationDate) {
|
||||
return this.consultationRepository.findConsultationByPatientAndDate(patientId, consultationDate);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user