debugged, added OneFridge Recipie
This commit is contained in:
@@ -6,6 +6,7 @@ import org.springframework.http.HttpEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import whattocook.repositories.ApiService;
|
||||
import whattocook.repositories.ItemRepository;
|
||||
import whattocook.implementation.ApiServiceImpl;
|
||||
|
||||
@@ -14,11 +15,12 @@ import java.util.LinkedList;
|
||||
|
||||
@Controller
|
||||
public class SpoonacularController {
|
||||
private int nextRecepies;
|
||||
private int nextRecepies=10;
|
||||
private int nextRecepiesForOneRandom=20;
|
||||
@Autowired
|
||||
private ItemRepository itemRepository;
|
||||
@Autowired
|
||||
private ApiServiceImpl service;
|
||||
private ApiService service;
|
||||
|
||||
@GetMapping("api/forFridge")
|
||||
public HttpEntity<String> getForFridge() throws IOException, InterruptedException {
|
||||
@@ -31,6 +33,11 @@ public class SpoonacularController {
|
||||
//when user has food preferences apply instead of linked list.
|
||||
}
|
||||
|
||||
@GetMapping("api/oneFridge" )
|
||||
public HttpEntity<String> getOneFridge() throws IOException, InterruptedException {
|
||||
return new HttpEntity<>(service.getOneForIngridients(itemRepository.findAll(), nextRecepiesForOneRandom));
|
||||
}
|
||||
|
||||
public void setNextRecepies(int nextRecepies) {
|
||||
this.nextRecepies = nextRecepies;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user