fix front

This commit is contained in:
DozorovaA.A 2023-06-11 11:03:28 +04:00
parent 4b69a4ff4b
commit c96cf40dee
2 changed files with 4 additions and 6 deletions

Binary file not shown.

View File

@ -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;