src/Controller/MobileApi/V2/MeOnMap/GetGeoLocationsAction.php line 15

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Slivki\Controller\MobileApi\V2\MeOnMap;
  4. use Slivki\Message\Query\MeOnMap\GetGeoLocationsQuery;
  5. use Slivki\MessageHandler\Query\MeOnMap\GetGeoLocationHandler;
  6. use Slivki\Request\MeOnMap\GetGeoLocationsRequest;
  7. use OpenApi\Annotations as OA;
  8. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  9. use Symfony\Component\HttpFoundation\JsonResponse;
  10. use Symfony\Component\Routing\Annotation\Route;
  11. final class GetGeoLocationsAction extends AbstractController
  12. {
  13.     private GetGeoLocationHandler $geoLocationHandler;
  14.     public function __construct(GetGeoLocationHandler $geoLocationHandler)
  15.     {
  16.         $this->geoLocationHandler $geoLocationHandler;
  17.     }
  18.     /**
  19.      * @Route("/mobile/api/v2/me-on-map/geo-locations", methods={"GET"}, name="mobile_api_v2_me_on_map_geo_locations_get")
  20.      * @OA\Tag(name="Me on map")
  21.      * @OA\Response(
  22.      *     response=200,
  23.      *     description="Список геолокаций",
  24.      *     content={
  25.      *         @OA\MediaType(
  26.      *             mediaType="application/json",
  27.      *             @OA\Schema(
  28.      *                 @OA\Property(property="id", type="integer", description="ID геологации"),
  29.      *                 @OA\Property(property="offerId", type="integer", description="ID акции"),
  30.      *                 @OA\Property(property="offerWithoutCodes", type="boolean", description="Акция без промокодов"),
  31.      *                 @OA\Property(property="latitude", type="float", description="Широта"),
  32.      *                 @OA\Property(property="longitude", type="float", description="Долгота"),
  33.      *                 @OA\Property(property="mapPinColor", type="string", description="Цвет иконки"),
  34.      *                 @OA\Property(property="mapPinImageUrl", type="string", description="Картинка иконки"),
  35.      *                 @OA\Property(property="offerLogoImageUrl", type="string", description="Картинка логотипа акции"),
  36.      *                 @OA\Property(property="mapPrice", type="float", description="Цена на карте"),
  37.      *                 @OA\Property(property="mapRating", type="integer", description="Рейтинг на карте"),
  38.      *                 @OA\Property(property="address", type="string", description="Адрес"),
  39.      *                 @OA\Property(property="phones", type="array", description="Телефоны",
  40.      *                     @OA\Items(
  41.      *                         @OA\Property(property="phoneNumber", type="string", description="Номер"),
  42.      *                         @OA\Property(property="label", type="string", description="Пометка"),
  43.      *                     ),
  44.      *                 ),
  45.      *                 type="object",
  46.      *             ),
  47.      *         ),
  48.      *     }
  49.      * ),
  50.      * @OA\Parameter(
  51.      *     name="searchQuery",
  52.      *     in="query",
  53.      *     description="Поисковый запрос",
  54.      *     required=false,
  55.      *     @OA\Schema(type="string"),
  56.      * ),
  57.      * @OA\Parameter(
  58.      *     name="categoryIds[]",
  59.      *     in="query",
  60.      *     description="массив ID категорий",
  61.      *     required=false,
  62.      *     @OA\Schema(type="array", @OA\Items(type="integer")),
  63.      * )
  64.      */
  65.     public function __invoke(GetGeoLocationsRequest $request): JsonResponse
  66.     {
  67.         return new JsonResponse(
  68.             $this->geoLocationHandler->__invoke(new GetGeoLocationsQuery(
  69.                 $request->getSearchQuery(),
  70.                 $request->getCategoryIds()
  71.             )),
  72.         );
  73.     }
  74. }