Add Carte champs support to the API

This commit is contained in:
Paul Chavard 2018-10-22 19:27:52 +02:00
parent 17418edb54
commit 7cf225d443
4 changed files with 52 additions and 0 deletions

View file

@ -0,0 +1,11 @@
class Champs::CarteChampSerializer < ChampSerializer
has_many :geo_areas
def value
if object.value.present?
JSON.parse(object.value)
else
nil
end
end
end

View file

@ -0,0 +1,16 @@
class GeoAreaSerializer < ActiveModel::Serializer
attributes :geometry,
:source,
:surface_intersection,
:surface_parcelle,
:numero,
:feuille,
:section,
:code_dep,
:nom_com,
:code_com,
:code_arr,
:code,
:nom,
:commune
end