Commit 4318d7a1 authored by Emmanuel Raviart's avatar Emmanuel Raviart

Rename liste_pays to pays_refs and change its type from String to Vec<String>.

parent f9086f08
Pipeline #103130 passed with stage
in 2 minutes and 11 seconds
......@@ -90,7 +90,7 @@ pub struct Identifiants {
pub quantieme: String,
}
#[derive(Debug, Deserialize, GraphQLObject)]
#[derive(Debug, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct InfosReunionsInternationale {
#[serde(deserialize_with = "str_to_bool", rename = "estReunionInternationale")]
......@@ -101,6 +101,22 @@ pub struct InfosReunionsInternationale {
pub liste_pays: Option<ListePays>,
}
graphql_object!(InfosReunionsInternationale: Context |&self| {
field est_reunion_internationale(&executor) -> bool {
self.est_reunion_internationale
}
field pays_refs() -> Vec<&str> {
match &self.liste_pays {
None => vec![],
Some(ref liste_pays) => liste_pays.pays_ref
.iter()
.map(|ref pays_ref| pays_ref.as_str())
.collect(),
}
}
});
#[derive(Clone, Debug, Deserialize, GraphQLObject)]
#[serde(deny_unknown_fields)]
pub struct LieuReunion {
......@@ -185,13 +201,6 @@ pub struct ParticipantsInternes {
pub participants_internes: Vec<ParticipantInterne>,
}
#[derive(Clone, Debug, Deserialize, GraphQLObject)]
#[serde(deny_unknown_fields)]
pub struct PaysReunion {
#[serde(rename = "paysRef")]
pub pays_ref: String,
}
#[derive(Debug, Deserialize, GraphQLObject)]
#[serde(deny_unknown_fields)]
pub struct PersonneAuditionnee {
......
use acteurs::Acteur;
use contexts::Context;
use serde_utils::str_to_vec;
use textes_legislatifs::Document;
#[derive(Clone, Debug, Deserialize, GraphQLObject)]
......@@ -84,8 +85,8 @@ pub struct InfoJo {
#[derive(Clone, Debug, Deserialize, GraphQLObject)]
#[serde(deny_unknown_fields)]
pub struct ListePays {
#[serde(rename = "paysRef")]
pub pays_ref: String,
#[serde(deserialize_with = "str_to_vec", rename = "paysRef")]
pub pays_ref: Vec<String>,
}
#[derive(Clone, Debug, Deserialize)]
......
......@@ -657,13 +657,6 @@ graphql_object!(OrganeParlementaireInternational: Context |&self| {
}
}
field liste_pays() -> Option<&str> {
match &self.liste_pays {
None => None,
Some(ref liste_pays) => Some(liste_pays.pays_ref.as_str()),
}
}
field organe_parent(&executor) -> Option<&Organe> {
match &self.organe_parent {
None => None,
......@@ -681,6 +674,16 @@ graphql_object!(OrganeParlementaireInternational: Context |&self| {
}
}
field pays_refs() -> Vec<&str> {
match &self.liste_pays {
None => vec![],
Some(ref liste_pays) => liste_pays.pays_ref
.iter()
.map(|ref pays_ref| pays_ref.as_str())
.collect(),
}
}
field regime() -> Option<&str> {
match &self.regime {
None => None,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment