This commit is contained in:
Bhumi Shah
2025-12-05 20:31:13 +03:00
parent a6954c2013
commit af09df8047
18 changed files with 458 additions and 33 deletions

View File

@@ -1,6 +1,15 @@
package com.example.nto.service.impl;
import com.example.nto.entity.Booking;
import com.example.nto.entity.Employee;
import com.example.nto.excepation.EmployeeNotFoundException;
import com.example.nto.repository.BookingRepository;
import com.example.nto.repository.EmployeeRepository;
import com.example.nto.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* TODO: ДОРАБОТАТЬ в рамках задания
@@ -8,5 +17,25 @@ import com.example.nto.service.EmployeeService;
* МОЖНО: Добавлять методы, аннотации, зависимости
* НЕЛЬЗЯ: Изменять название класса и пакета
*/
@Service
public class EmployeeServiceImpl implements EmployeeService {
}
@Autowired
private EmployeeRepository employeeRepository;
@Autowired
private BookingRepository bookingRepository;
@Override
public Employee getEmployeeWithBookings(String code) {
if (code == null || code.isEmpty()) {
throw new IllegalArgumentException("Employee code cannot be null or empty");
}
Employee employee = employeeRepository.findByCode(code);
if (employee == null) {
throw new EmployeeNotFoundException("Employee not found with code: " + code);
}
return employee;
}
}