diff --git a/readme.md b/readme.md index 14ca349..0d417ee 100644 --- a/readme.md +++ b/readme.md @@ -36,8 +36,3 @@ Write an application that, at the endpoint specified by you, returns the yearly } ] ``` - -## Usage - -Temperature statistics endpoint: `/api/temperatures/{city}` -Returns HTTP 200 when city is found, 404 otherwise. diff --git a/src/main/java/eu/ztsh/lfr/core/TemperaturesService.java b/src/main/java/eu/ztsh/lfr/core/TemperaturesService.java deleted file mode 100644 index 1ee66e3..0000000 --- a/src/main/java/eu/ztsh/lfr/core/TemperaturesService.java +++ /dev/null @@ -1,13 +0,0 @@ -package eu.ztsh.lfr.core; - -import eu.ztsh.lfr.model.Entry; -import jakarta.annotation.Nonnull; - -import java.util.List; - -public interface TemperaturesService { - - @Nonnull - List getTemperaturesFor(String city); - -} diff --git a/src/main/java/eu/ztsh/lfr/core/impl/TemperaturesServiceImpl.java b/src/main/java/eu/ztsh/lfr/core/impl/TemperaturesServiceImpl.java deleted file mode 100644 index 79b2f27..0000000 --- a/src/main/java/eu/ztsh/lfr/core/impl/TemperaturesServiceImpl.java +++ /dev/null @@ -1,19 +0,0 @@ -package eu.ztsh.lfr.core.impl; - -import eu.ztsh.lfr.core.TemperaturesService; -import eu.ztsh.lfr.model.Entry; -import jakarta.annotation.Nonnull; -import org.springframework.stereotype.Service; - -import java.util.List; - -@Service -public class TemperaturesServiceImpl implements TemperaturesService { - - @Nonnull - @Override - public List getTemperaturesFor(String city) { - throw new UnsupportedOperationException("Not supported yet."); - } - -} diff --git a/src/main/java/eu/ztsh/lfr/web/TemperaturesController.java b/src/main/java/eu/ztsh/lfr/web/TemperaturesController.java deleted file mode 100644 index 52a2685..0000000 --- a/src/main/java/eu/ztsh/lfr/web/TemperaturesController.java +++ /dev/null @@ -1,32 +0,0 @@ -package eu.ztsh.lfr.web; - -import eu.ztsh.lfr.core.TemperaturesService; -import eu.ztsh.lfr.model.Entry; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -@RestController -@RequestMapping("/api/temperatures") -public class TemperaturesController { - - private final TemperaturesService temperaturesService; - - @Autowired - public TemperaturesController(TemperaturesService temperaturesService) { - this.temperaturesService = temperaturesService; - } - - @GetMapping("/{city}") - public ResponseEntity> getTemperatures(@PathVariable String city) { - var data = temperaturesService.getTemperaturesFor(city); - - return data.isEmpty() ? ResponseEntity.notFound().build() : ResponseEntity.ok(data); - } - -}