mirror of
https://github.com/grocy/grocy.git
synced 2026-04-07 05:16:15 +02:00
Use FilteredApiResponse for Recipe-Fullfillment
This commit is contained in:
parent
5c82fe14ca
commit
4690b1e595
|
|
@ -44,7 +44,7 @@ class RecipesApiController extends BaseApiController
|
||||||
{
|
{
|
||||||
if (!isset($args['recipeId']))
|
if (!isset($args['recipeId']))
|
||||||
{
|
{
|
||||||
return $this->ApiResponse($response, $this->getRecipesService()->GetRecipesResolved());
|
return $this->FilteredApiResponse($response, $this->getRecipesService()->GetRecipesResolved(), $request->getQueryParams());
|
||||||
}
|
}
|
||||||
|
|
||||||
$recipeResolved = FindObjectInArrayByPropertyValue($this->getRecipesService()->GetRecipesResolved(), 'recipe_id', $args['recipeId']);
|
$recipeResolved = FindObjectInArrayByPropertyValue($this->getRecipesService()->GetRecipesResolved(), 'recipe_id', $args['recipeId']);
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ namespace Grocy\Services;
|
||||||
|
|
||||||
#use \Grocy\Services\StockService;
|
#use \Grocy\Services\StockService;
|
||||||
|
|
||||||
|
use LessQL\Result;
|
||||||
|
|
||||||
class RecipesService extends BaseService
|
class RecipesService extends BaseService
|
||||||
{
|
{
|
||||||
const RECIPE_TYPE_MEALPLAN_DAY = 'mealplan-day';
|
const RECIPE_TYPE_MEALPLAN_DAY = 'mealplan-day';
|
||||||
|
|
@ -82,10 +84,9 @@ class RecipesService extends BaseService
|
||||||
return $this->getDataBaseService()->ExecuteDbQuery($sql)->fetchAll(\PDO::FETCH_OBJ);
|
return $this->getDataBaseService()->ExecuteDbQuery($sql)->fetchAll(\PDO::FETCH_OBJ);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetRecipesResolved()
|
public function GetRecipesResolved(): Result
|
||||||
{
|
{
|
||||||
$sql = 'SELECT * FROM recipes_resolved';
|
return $this->getDatabase()->recipes_resolved();
|
||||||
return $this->getDataBaseService()->ExecuteDbQuery($sql)->fetchAll(\PDO::FETCH_OBJ);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user