diff --git a/src/Actions/PrepareMenuAction.php b/src/Actions/PrepareMenuAction.php new file mode 100644 index 0000000000000000000000000000000000000000..6c819831ff2c5e757354a29e2325268c881ea3fb --- /dev/null +++ b/src/Actions/PrepareMenuAction.php @@ -0,0 +1,35 @@ +act($request->serialise())); + } +} diff --git a/src/Controller/SortPriceController.php b/src/Controller/SortPriceController.php index 313d3dc8c22d4304111a09bcec01e3a5b1bab5da..0f1d250b6c31ea3f0dee3f4581c722d10adb2cdf 100644 --- a/src/Controller/SortPriceController.php +++ b/src/Controller/SortPriceController.php @@ -3,28 +3,22 @@ namespace App\Controller; use App\Actions\SortPriceAction; -use App\Entity\PricesEntity; use App\Requests\PricesRequest; -use App\Service\ValidationService; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Attribute\Route; class SortPriceController extends AbstractController { /** * Контроллер волняет сортировку массива по убыванию цены используя sortPrice - * @param Request $request + * @param PricesRequest $request * @param SortPriceAction $action * @return JsonResponse */ #[Route('/sort/price', name: 'app_sort_price', methods: ['POST'])] public function index(PricesRequest $request, SortPriceAction $action): JsonResponse { - return new JsonResponse( - $action->act($request->serialise()), - 200 - ); + return new JsonResponse($action->act($request->serialise())); } } diff --git a/src/Requests/MenuRequest.php b/src/Requests/MenuRequest.php new file mode 100644 index 0000000000000000000000000000000000000000..99bf7832858bdbab9739ab66d52845988756873d --- /dev/null +++ b/src/Requests/MenuRequest.php @@ -0,0 +1,32 @@ + [ + new NotBlank(), + new Type('string'), + ], + 'depth' => [ + new NotBlank(), + new Type('integer'), + ] + ]) + )] + public $menu; + + public function serialise(): mixed + { + return $this->menu; + } +}