Allow recipe ingredients to be ignored when putting them on the shopping list (closes #125)

This commit is contained in:
Bernd Bestel
2019-03-03 14:49:46 +01:00
parent 89ad25c904
commit e9ef7ea6d8
6 changed files with 71 additions and 6 deletions

View File

@@ -16,7 +16,15 @@ class RecipesApiController extends BaseApiController
public function AddNotFulfilledProductsToShoppingList(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
{
$this->RecipesService->AddNotFulfilledProductsToShoppingList($args['recipeId']);
$requestBody = $request->getParsedBody();
$excludedProductIds = null;
if ($requestBody !== null && array_key_exists('excludedProductIds', $requestBody))
{
$excludedProductIds = $requestBody['excludedProductIds'];
}
$this->RecipesService->AddNotFulfilledProductsToShoppingList($args['recipeId'], $excludedProductIds);
return $this->EmptyApiResponse($response);
}