Use FilteredApiResponse for Recipe-Fullfillment

This commit is contained in:
fipwmaqzufheoxq92ebc 2020-09-01 14:01:40 +02:00
parent 5c82fe14ca
commit 4690b1e595
No known key found for this signature in database
GPG Key ID: F4DF989490C2ADB7
2 changed files with 5 additions and 4 deletions

View File

@ -44,7 +44,7 @@ class RecipesApiController extends BaseApiController
{
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']);

View File

@ -4,6 +4,8 @@ namespace Grocy\Services;
#use \Grocy\Services\StockService;
use LessQL\Result;
class RecipesService extends BaseService
{
const RECIPE_TYPE_MEALPLAN_DAY = 'mealplan-day';
@ -82,10 +84,9 @@ class RecipesService extends BaseService
return $this->getDataBaseService()->ExecuteDbQuery($sql)->fetchAll(\PDO::FETCH_OBJ);
}
public function GetRecipesResolved()
public function GetRecipesResolved(): Result
{
$sql = 'SELECT * FROM recipes_resolved';
return $this->getDataBaseService()->ExecuteDbQuery($sql)->fetchAll(\PDO::FETCH_OBJ);
return $this->getDatabase()->recipes_resolved();
}
public function __construct()