.../api/{id}/auth - работает =)

This commit is contained in:
lynxwq2
2025-11-27 20:43:12 +03:00
parent a3a43fe7a0
commit 4a22c9d466
3 changed files with 19 additions and 6 deletions

View File

@@ -3,6 +3,7 @@ package com.example.nto.service.impl;
import com.example.nto.entity.Employee;
import com.example.nto.repository.EmployeeRepository;
import com.example.nto.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
@@ -20,6 +21,7 @@ import java.util.Optional;
public class EmployeeServiceImpl implements EmployeeService {
private final EmployeeRepository employeeRepository;
@Autowired
public EmployeeServiceImpl(EmployeeRepository employeeRepository) {
this.employeeRepository = employeeRepository;
}
@@ -33,4 +35,8 @@ public class EmployeeServiceImpl implements EmployeeService {
public Optional<Employee> getById(long id) {
return employeeRepository.findById(id);
}
public boolean isIdValid(long id){
return employeeRepository.findById(id).isPresent();
}
}