From da2312152d149a99e861f1c407363a779b21e02a Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Mon, 30 Sep 2024 16:43:46 +0200 Subject: [PATCH] graphql(personne_morale): return full address --- app/graphql/types/personne_morale_type.rb | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/app/graphql/types/personne_morale_type.rb b/app/graphql/types/personne_morale_type.rb index 913d65590..cfa63db30 100644 --- a/app/graphql/types/personne_morale_type.rb +++ b/app/graphql/types/personne_morale_type.rb @@ -124,16 +124,10 @@ module Types field :complement_adresse, String, null: true, deprecation_reason: "Utilisez le champ `address` à la place." def address - { - label: object.adresse, - type: "housenumber", - street_number: object.numero_voie, - street_name: object.nom_voie, - street_address: object.nom_voie.present? ? [object.numero_voie, object.type_voie, object.nom_voie].compact.join(' ') : nil, - postal_code: object.code_postal.presence || '', - city_name: object.localite.presence || '', - city_code: object.code_insee_localite.presence || '' - }.with_indifferent_access + APIGeoService + .parse_etablissement_address(object) + .merge(label: object.adresse, type: "housenumber") + .with_indifferent_access end def entreprise