Refactored the codebase to change the namespaces of various actions and queries from `App\Actions` to `App\Cqs\Actions` and `App\Queries` to `App\Cqs\Queries`. This restructuring improves organization and clarity in the codebase.
36 lines
956 B
PHP
36 lines
956 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Cqs\Queries\Orders;
|
|
|
|
use App\Contracts\Query;
|
|
use App\Contracts\QueryInput;
|
|
use Domain\Enums\OrderTunnelStep;
|
|
use Domain\Services\BasketService;
|
|
use Webmozart\Assert\Assert;
|
|
|
|
/**
|
|
* @implements \App\Contracts\Query<\App\Cqs\Queries\Orders\GetBasketSummaryQueryInput, \App\Cqs\Queries\Orders\GetBasketSummaryQueryOutput>
|
|
*/
|
|
final readonly class GetBasketSummaryQuery implements Query
|
|
{
|
|
public function __construct(
|
|
private BasketService $basketService,
|
|
) {
|
|
}
|
|
|
|
/**
|
|
* @param \App\Cqs\Queries\Orders\GetBasketSummaryQueryInput $input
|
|
*/
|
|
#[\Override]
|
|
public function __invoke(QueryInput $input): GetBasketSummaryQueryOutput
|
|
{
|
|
Assert::isInstanceOf($input, GetBasketSummaryQueryInput::class);
|
|
|
|
return new GetBasketSummaryQueryOutput(
|
|
step: OrderTunnelStep::REVIEW,
|
|
basket: $this->basketService->getBasket(),
|
|
);
|
|
}
|
|
}
|