updated paths of SpoonacularController to match the rest
This commit is contained in:
@@ -2,8 +2,8 @@ package whattocook.controller;
|
|||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.rest.webmvc.BasePathAwareController;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import spoonaccular.RecipeInformation;
|
import spoonaccular.RecipeInformation;
|
||||||
import spoonaccular.RecipeSearch;
|
import spoonaccular.RecipeSearch;
|
||||||
@@ -16,7 +16,7 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController()
|
@RestController()
|
||||||
@RequestMapping(path = "recipe")
|
@BasePathAwareController()
|
||||||
public class SpoonacularController {
|
public class SpoonacularController {
|
||||||
private int nextRecepies=10;
|
private int nextRecepies=10;
|
||||||
private int nextRecepiesForOneRandom=20;
|
private int nextRecepiesForOneRandom=20;
|
||||||
@@ -27,18 +27,18 @@ public class SpoonacularController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private RecipeSearch recipeSearch;
|
private RecipeSearch recipeSearch;
|
||||||
|
|
||||||
@GetMapping("/forFridge")
|
@GetMapping("/recipe/forFridge")
|
||||||
public List<ExtendedRecipeByIngredient> getForFridge() throws IOException {
|
public List<ExtendedRecipeByIngredient> getForFridge() throws IOException {
|
||||||
return recipeSearch.getForIngridients(itemRepository.findAll(), nextRecepies);
|
return recipeSearch.getForIngridients(itemRepository.findAll(), nextRecepies);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/random")
|
@GetMapping("/recipe/random")
|
||||||
public List<Recipe> getRandom() throws IOException, InterruptedException, JSONException {
|
public List<Recipe> getRandom() throws IOException, InterruptedException, JSONException {
|
||||||
return recipeSearch.getRandom(new LinkedList<>(), nextRecepies);
|
return recipeSearch.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("/recipe/oneFridge")
|
||||||
public ExtendedRecipeByIngredient getOneFridge() throws IOException {
|
public ExtendedRecipeByIngredient getOneFridge() throws IOException {
|
||||||
return recipeSearch.getOneForIngridients(itemRepository.findAll(), nextRecepiesForOneRandom);
|
return recipeSearch.getOneForIngridients(itemRepository.findAll(), nextRecepiesForOneRandom);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user