diff --git a/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcher.php b/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcher.php new file mode 100644 index 000000000..2fbd6b0ec --- /dev/null +++ b/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcher.php @@ -0,0 +1,15 @@ + GeographicalUnitLayer::class, + 'name' => 'geographical-unit-layer', + 'base_path' => '/api/1.0/main/geographical-unit-layer', + 'base_role' => 'ROLE_USER', + 'actions' => [ + '_index' => [ + 'methods' => [ + Request::METHOD_GET => true, + Request::METHOD_HEAD => true, + ], + ], + ], + ] ], ]); } diff --git a/src/Bundle/ChillMainBundle/Entity/GeographicalUnitLayer.php b/src/Bundle/ChillMainBundle/Entity/GeographicalUnitLayer.php index bdea40563..b856c7a21 100644 --- a/src/Bundle/ChillMainBundle/Entity/GeographicalUnitLayer.php +++ b/src/Bundle/ChillMainBundle/Entity/GeographicalUnitLayer.php @@ -14,6 +14,7 @@ namespace Chill\MainBundle\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Serializer\Annotation as Serializer; /** * @ORM\Table(name="chill_main_geographical_unit_layer", uniqueConstraints={ @@ -27,16 +28,19 @@ class GeographicalUnitLayer * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") + * @Serializer\Groups({"read"}) */ private ?int $id = null; /** * @ORM\Column(type="json", nullable=false, options={"default": "[]"}) + * @Serializer\Groups({"read"}) */ private array $name = []; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) + * @Serializer\Groups({"read"}) */ private string $refId = ''; diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/api/address.ts b/src/Bundle/ChillMainBundle/Resources/public/lib/api/address.ts index d039daf12..1f0d6ae8a 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/api/address.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/lib/api/address.ts @@ -1,4 +1,5 @@ -import {Address} from "../../types"; +import {Address, GeographicalUnitLayer, SimpleGeographicalUnit} from "../../types"; +import {fetchResults, makeFetch} from "./apiMethods"; export const getAddressById = async (address_id: number): Promise
=> { @@ -12,3 +13,11 @@ export const getAddressById = async (address_id: number): Promise => throw Error('Error with request resource response'); }; + +export const getGeographicalUnitsByAddress = async (address: Address): PromiseVoir sur Google Maps OSM