feat(graphql): add postalCode to champ commune
This commit is contained in:
parent
dc605015b3
commit
666db74b09
2 changed files with 13 additions and 13 deletions
|
@ -404,7 +404,16 @@ type Commune {
|
||||||
Le code INSEE
|
Le code INSEE
|
||||||
"""
|
"""
|
||||||
code: String!
|
code: String!
|
||||||
|
|
||||||
|
"""
|
||||||
|
Le nom de la commune
|
||||||
|
"""
|
||||||
name: String!
|
name: String!
|
||||||
|
|
||||||
|
"""
|
||||||
|
Le code postal
|
||||||
|
"""
|
||||||
|
postalCode: String
|
||||||
}
|
}
|
||||||
|
|
||||||
type CommuneChamp implements Champ {
|
type CommuneChamp implements Champ {
|
||||||
|
|
|
@ -3,29 +3,20 @@ module Types::Champs
|
||||||
implements Types::ChampType
|
implements Types::ChampType
|
||||||
|
|
||||||
class CommuneType < Types::BaseObject
|
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 :code, String, "Le code INSEE", null: false
|
||||||
|
field :postal_code, String, "Le code postal", null: true, method: :code_postal
|
||||||
end
|
end
|
||||||
|
|
||||||
field :commune, CommuneType, null: true
|
field :commune, CommuneType, null: true
|
||||||
field :departement, Types::Champs::DepartementChampType::DepartementType, null: true
|
field :departement, Types::Champs::DepartementChampType::DepartementType, null: true
|
||||||
|
|
||||||
def commune
|
def commune
|
||||||
if object.code?
|
object if object.code?
|
||||||
{
|
|
||||||
name: object.to_s,
|
|
||||||
code: object.code
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def departement
|
def departement
|
||||||
if object.departement?
|
object.departement if object.departement?
|
||||||
{
|
|
||||||
name: object.name_departement,
|
|
||||||
code: object.code_departement
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue