debugged, added OneFridge Recipie

This commit is contained in:
Bruno
2022-06-17 17:15:24 +02:00
parent 724e765cd6
commit 105aaf6bad
3 changed files with 46 additions and 15 deletions

View File

@@ -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;
}