feat(graphql): add postalCode to champ commune

This commit is contained in:
Paul Chavard 2023-03-21 14:45:48 +01:00
parent dc605015b3
commit 666db74b09
2 changed files with 13 additions and 13 deletions

View file

@ -404,7 +404,16 @@ type Commune {
Le code INSEE
"""
code: String!
"""
Le nom de la commune
"""
name: String!
"""
Le code postal
"""
postalCode: String
}
type CommuneChamp implements Champ {

View file

@ -3,29 +3,20 @@ module Types::Champs
implements Types::ChampType
class CommuneType < Types::BaseObject
field :name, String, null: false
field :name, String, "Le nom de la commune", null: false
field :code, String, "Le code INSEE", null: false
field :postal_code, String, "Le code postal", null: true, method: :code_postal
end
field :commune, CommuneType, null: true
field :departement, Types::Champs::DepartementChampType::DepartementType, null: true
def commune
if object.code?
{
name: object.to_s,
code: object.code
}
end
object if object.code?
end
def departement
if object.departement?
{
name: object.name_departement,
code: object.code_departement
}
end
object.departement if object.departement?
end
end
end