fix: Entry renamed to Average
This commit is contained in:
parent
625dd63137
commit
f63604a18a
4 changed files with 8 additions and 8 deletions
|
@ -3,7 +3,7 @@
|
|||
"$schema": "http://json-schema.org/draft/2020-12/schema",
|
||||
"type": "array",
|
||||
"def": {
|
||||
"entry": {
|
||||
"average": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"year": {
|
||||
|
@ -20,6 +20,6 @@
|
|||
}
|
||||
},
|
||||
"items": {
|
||||
"$ref": "#/def/entry"
|
||||
"$ref": "#/def/average"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package eu.ztsh.lfr.core;
|
||||
|
||||
import eu.ztsh.lfr.model.Entry;
|
||||
import eu.ztsh.lfr.model.Average;
|
||||
import jakarta.annotation.Nonnull;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -8,6 +8,6 @@ import java.util.List;
|
|||
public interface TemperaturesService {
|
||||
|
||||
@Nonnull
|
||||
List<Entry> getTemperaturesFor(String city);
|
||||
List<Average> getTemperaturesFor(String city);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package eu.ztsh.lfr.core.impl;
|
||||
|
||||
import eu.ztsh.lfr.core.TemperaturesService;
|
||||
import eu.ztsh.lfr.model.Entry;
|
||||
import eu.ztsh.lfr.model.Average;
|
||||
import jakarta.annotation.Nonnull;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -12,7 +12,7 @@ public class TemperaturesServiceImpl implements TemperaturesService {
|
|||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<Entry> getTemperaturesFor(String city) {
|
||||
public List<Average> getTemperaturesFor(String city) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package eu.ztsh.lfr.web;
|
||||
|
||||
import eu.ztsh.lfr.core.TemperaturesService;
|
||||
import eu.ztsh.lfr.model.Entry;
|
||||
import eu.ztsh.lfr.model.Average;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
@ -23,7 +23,7 @@ public class TemperaturesController {
|
|||
}
|
||||
|
||||
@GetMapping("/{city}")
|
||||
public ResponseEntity<List<Entry>> getTemperatures(@PathVariable String city) {
|
||||
public ResponseEntity<List<Average>> getTemperatures(@PathVariable String city) {
|
||||
var data = temperaturesService.getTemperaturesFor(city);
|
||||
|
||||
return data.isEmpty() ? ResponseEntity.notFound().build() : ResponseEntity.ok(data);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue