diff --git a/data.mv.db b/data.mv.db index 5e93dc1..0eb1899 100644 Binary files a/data.mv.db and b/data.mv.db differ diff --git a/src/main/java/com/example/demo/speaker/service/EmployeeService.java b/src/main/java/com/example/demo/speaker/service/EmployeeService.java index 1cee43b..7f72201 100644 --- a/src/main/java/com/example/demo/speaker/service/EmployeeService.java +++ b/src/main/java/com/example/demo/speaker/service/EmployeeService.java @@ -4,9 +4,7 @@ import com.example.demo.speaker.controller.EmployeeDTO; import com.example.demo.speaker.model.Appointment; import com.example.demo.speaker.model.Employee; import com.example.demo.speaker.model.RequestForCooperation; -import com.example.demo.speaker.repository.IAppointmentRepository; import com.example.demo.speaker.repository.IEmployeeRepository; -import com.example.demo.speaker.repository.IRequestForCooperationRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -16,16 +14,16 @@ import java.util.Optional; @Service public class EmployeeService { private final IEmployeeRepository employeeRepository; -private final AppointmentService appointmentRepository; +private final AppointmentService appointmentService; - public EmployeeService(IEmployeeRepository employeeRepository, AppointmentService appointmentRepository) { + public EmployeeService(IEmployeeRepository employeeRepository, AppointmentService appointmentService) { this.employeeRepository = employeeRepository; - this.appointmentRepository = appointmentRepository; + this.appointmentService = appointmentService; } @Transactional public Employee addWorker(EmployeeDTO employee) { - var appontment = appointmentRepository.findAppointment(employee.getAppointment().getId()); + var appontment = appointmentService.findAppointment(employee.getAppointment().getId()); Employee employeeNew = new Employee(employee.getFio(), appontment); employeeRepository.save(employeeNew); return employeeNew;