.../api/{id}/auth - работает =)
This commit is contained in:
@@ -2,7 +2,10 @@ package com.example.nto.controller;
|
||||
|
||||
import com.example.nto.entity.Employee;
|
||||
import com.example.nto.service.EmployeeService;
|
||||
import com.example.nto.service.impl.EmployeeServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.net.http.HttpResponse;
|
||||
@@ -15,12 +18,8 @@ import java.util.List;
|
||||
* НЕЛЬЗЯ: Изменять название класса и пакета
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("code")
|
||||
@RequestMapping("api")
|
||||
public class EmployeeController {
|
||||
// @GetMapping("/auth/{id}")
|
||||
// public int isAuth(@PathVariable int id){
|
||||
// return id;
|
||||
// }
|
||||
|
||||
private final EmployeeService employeeService;
|
||||
|
||||
@@ -31,6 +30,12 @@ public class EmployeeController {
|
||||
|
||||
@GetMapping("/{id}/auth")
|
||||
public HttpStatus Isauth(@PathVariable long id){
|
||||
return HttpStatus.OK;
|
||||
if(employeeService.isIdValid(id)){
|
||||
return HttpStatus.OK;
|
||||
}
|
||||
else
|
||||
return HttpStatus.NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user