- Implement GetCategoriesProductsQuery and GetCategoriesProductsQueryInput for product category retrieval. - Implement GetRelatedProductsQuery and GetRelatedProductsQueryInput for related product fetching. - Implement GetFrontRecipesQuery and GetFrontRecipesQueryInput for front-end recipe listing. - Implement GetRelatedRecipesQuery and GetRelatedRecipesQueryInput for related recipe fetching. - Update ProductController and RecipeController to utilize new query classes. - Enhance IndexProductRequest and IndexRecipeRequest to convert requests to query inputs.
34 lines
1.1 KiB
PHP
34 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Cqs\Queries\Recipes;
|
|
|
|
use App\Contracts\QueryInput;
|
|
use Domain\Models\ValueObjects\Products\ProductCategory;
|
|
use Domain\Models\ValueObjects\Recipes\ConsumptionTime;
|
|
use Domain\Models\ValueObjects\Recipes\Inspiration;
|
|
use Domain\Models\ValueObjects\Recipes\Season;
|
|
use Webmozart\Assert\Assert;
|
|
|
|
final readonly class GetFrontRecipesQueryInput implements QueryInput
|
|
{
|
|
/**
|
|
* @param ProductCategory[] $categories
|
|
* @param ConsumptionTime[] $consumptionTimes
|
|
* @param Inspiration[] $inspirations
|
|
* @param Season[] $seasons
|
|
*/
|
|
public function __construct(
|
|
public array $categories = [],
|
|
public array $consumptionTimes = [],
|
|
public array $inspirations = [],
|
|
public array $seasons = [],
|
|
public string $search = '',
|
|
) {
|
|
Assert::allIsAOf($this->categories, ProductCategory::class);
|
|
Assert::allIsAOf($this->consumptionTimes, ConsumptionTime::class);
|
|
Assert::allIsAOf($this->inspirations, Inspiration::class);
|
|
Assert::allIsAOf($this->seasons, Season::class);
|
|
}
|
|
}
|