|
|
@ -3,6 +3,7 @@ package space.kklochko.spring_rest_example.controllers;
|
|
|
|
import jakarta.persistence.Entity;
|
|
|
|
import jakarta.persistence.Entity;
|
|
|
|
import jakarta.persistence.EntityManager;
|
|
|
|
import jakarta.persistence.EntityManager;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import space.kklochko.spring_rest_example.db.repositories.IndicatorRepository;
|
|
|
|
import space.kklochko.spring_rest_example.db.repositories.IndicatorRepository;
|
|
|
@ -40,8 +41,13 @@ public class IndicatorController {
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/{id}")
|
|
|
|
@GetMapping("/{id}")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public Indicator get(@PathVariable UUID id) {
|
|
|
|
public ResponseEntity<?> get(@PathVariable UUID id) {
|
|
|
|
return indicatorRepository.read(id);
|
|
|
|
Indicator indicator = indicatorRepository.read(id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(indicator == null)
|
|
|
|
|
|
|
|
return new ResponseEntity<>("Indicator not found", HttpStatus.NOT_FOUND);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new ResponseEntity<>(indicator, HttpStatus.OK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping
|
|
|
|
@GetMapping
|
|
|
|