src/Controller/MobileApi/V2/MeOnMap/GetCategoriesWithGeoLocationAction.php line 13

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Slivki\Controller\MobileApi\V2\MeOnMap;
  4. use Slivki\Message\Query\MeOnMap\GetCategoriesWithGeoLocationsQuery;
  5. use Slivki\MessageHandler\Query\MeOnMap\GetCategoriesWithGeoLocationsHandler;
  6. use Symfony\Component\HttpFoundation\JsonResponse;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. use OpenApi\Annotations as OA;
  9. final class GetCategoriesWithGeoLocationAction
  10. {
  11.     private GetCategoriesWithGeoLocationsHandler $getCategoriesWithGeoLocationsHandler;
  12.     public function __construct(GetCategoriesWithGeoLocationsHandler $getCategoriesWithGeoLocationsHandler)
  13.     {
  14.         $this->getCategoriesWithGeoLocationsHandler $getCategoriesWithGeoLocationsHandler;
  15.     }
  16.     /**
  17.      * @Route("/mobile/api/v2/me-on-map/categories/{cityId}", methods={"GET"}, name="mobile_api_v2_me_on_map_categories_get")
  18.      * @OA\Tag(name="Me on map")
  19.      * @OA\Response(
  20.      *     response=200,
  21.      *     description="Список категорий с геолокациями",
  22.      *     @OA\Schema(
  23.      *         @OA\Property(
  24.      *             property="categories",
  25.      *             description="Список категорий с геолокациями",
  26.      *             type="array",
  27.      *             @OA\Items(
  28.      *                 type="object",
  29.      *                 @OA\Property(property="id", type="integer"),
  30.      *                 @OA\Property(property="name", type="string"),
  31.      *                 @OA\Property(property="image", type="string"),
  32.      *                 @OA\Property(property="offersCount", type="integer"),
  33.      *                 @OA\Property(property="featurePosition", type="integer"),
  34.      *                 @OA\Property(
  35.      *                      property="offerIds",
  36.      *                      type="array",
  37.      *                      @OA\Items(type="integer"),
  38.      *                 ),
  39.      *             ),
  40.      *         ),
  41.      *         @OA\Property(
  42.      *             property="featuredCategories",
  43.      *             description="Список топовых категорий с геолокациями",
  44.      *             type="array",
  45.      *             @OA\Items(
  46.      *                 type="object",
  47.      *                 @OA\Property(property="id", type="integer"),
  48.      *                 @OA\Property(property="name", type="string"),
  49.      *                 @OA\Property(property="image", type="string"),
  50.      *                 @OA\Property(property="offersCount", type="integer"),
  51.      *                 @OA\Property(property="featurePosition", type="integer"),
  52.      *                 @OA\Property(
  53.      *                      property="offerIds",
  54.      *                      type="array",
  55.      *                      @OA\Items(type="integer"),
  56.      *                 ),
  57.      *             ),
  58.      *         ),
  59.      *         @OA\Property(
  60.      *             property="featuredCategoryIds",
  61.      *             description="[deprecated] Список айди выделенных категорий",
  62.      *             type="array",
  63.      *             @OA\Items(type="integer"),
  64.      *         ),
  65.      *         @OA\Property(
  66.      *             property="featuredOffers",
  67.      *             description="Список акций",
  68.      *             type="array",
  69.      *             @OA\Items(
  70.      *                 type="object",
  71.      *                 @OA\Property(property="id", type="integer"),
  72.      *                 @OA\Property(property="name", type="string"),
  73.      *                 @OA\Property(property="image", type="string"),
  74.      *                 @OA\Property(property="featurePosition", type="integer"),
  75.      *             ),
  76.      *         ),
  77.      *     ),
  78.      * ),
  79.      * @OA\Parameter(
  80.      *     name="cityId",
  81.      *     in="path",
  82.      *     description="ID города",
  83.      *     required=true,
  84.      *     @OA\Schema(type="integer"),
  85.      * ),
  86.      */
  87.     public function __invoke(int $cityId): JsonResponse
  88.     {
  89.         return new JsonResponse(
  90.             $this->getCategoriesWithGeoLocationsHandler->__invoke(new GetCategoriesWithGeoLocationsQuery($cityId)),
  91.         );
  92.     }
  93. }