made endpoints better
This commit is contained in:
@@ -27,18 +27,18 @@ public class SpoonacularController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SpoonacularApiService service;
|
private SpoonacularApiService service;
|
||||||
|
|
||||||
@GetMapping("forFridge")
|
@GetMapping("/forFridge")
|
||||||
public HttpEntity<JSONArray> getForFridge() throws IOException, InterruptedException, JSONException {
|
public HttpEntity<JSONArray> getForFridge() throws IOException, InterruptedException, JSONException {
|
||||||
return new HttpEntity<JSONArray>(service.getForIngridients(itemRepository.findAll(), nextRecepies));
|
return new HttpEntity<JSONArray>(service.getForIngridients(itemRepository.findAll(), nextRecepies));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("random")
|
@GetMapping("/random")
|
||||||
public HttpEntity<JSONArray> getRandom() throws IOException, InterruptedException, JSONException {
|
public HttpEntity<JSONArray> getRandom() throws IOException, InterruptedException, JSONException {
|
||||||
return new HttpEntity<JSONArray>(service.getRandom(new LinkedList<>(), nextRecepies));
|
return new HttpEntity<JSONArray>(service.getRandom(new LinkedList<>(), nextRecepies));
|
||||||
//when user has food preferences apply instead of linked list.
|
//when user has food preferences apply instead of linked list.
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("oneFridge")
|
@GetMapping("/oneFridge")
|
||||||
public HttpEntity<JSONObject> getOneFridge() throws IOException, InterruptedException, JSONException {
|
public HttpEntity<JSONObject> getOneFridge() throws IOException, InterruptedException, JSONException {
|
||||||
return new HttpEntity<JSONObject>(service.getOneForIngridients(itemRepository.findAll(), nextRecepiesForOneRandom));
|
return new HttpEntity<JSONObject>(service.getOneForIngridients(itemRepository.findAll(), nextRecepiesForOneRandom));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user