Si vous constatez la perte de tickets, de commentaires ou de projets, veuillez consulter la page https://status.framasoft.org/incident/626.

Commit 303d9825 authored by Emmanuel Raviart's avatar Emmanuel Raviart

Improve GraphQL of fields `organe_parent` & `liste_pays` of "organes".

parent 392bb480
Pipeline #101966 passed with stage
in 2 minutes and 8 seconds
......@@ -59,7 +59,17 @@ graphql_object!(GroupePolitique: Context |&self| {
}
}
field organe_parent() -> Option<&str> {
field organe_parent(&executor) -> Option<&Organe> {
match &self.organe_parent {
None => None,
Some(ref organe_parent) => {
let context = &executor.context();
context.get_organe_at_uid(organe_parent)
},
}
}
field organe_parent_ref() -> Option<&str> {
match &self.organe_parent {
None => None,
Some(ref s) => Some(s.as_str()),
......@@ -113,9 +123,7 @@ impl Organe {
// match *self {
// Organe::GroupePolitique(GroupePolitique { code_type, .. })
// | Organe::OrganeExterne(OrganeExterne { code_type, .. })
// | Organe::OrganeExtraParlementaire(OrganeExtraParlementaire {
// code_type, ..
// })
// | Organe::OrganeExtraParlementaire(OrganeExtraParlementaire { code_type, .. })
// | Organe::OrganeParlementaire(OrganeParlementaire { code_type, .. })
// | Organe::OrganeParlementaireInternational(OrganeParlementaireInternational { code_type, .. }) => code_type,
// }
......@@ -276,8 +284,21 @@ graphql_union!(Organe: Context |&self| {
// self.libelle_edition()
// }
// field organe_parent() -> Option<&str> {
// self.organe_parent()
// field organe_parent(&executor) -> Option<&Organe> {
// match &self.organe_parent {
// None => None,
// Some(ref organe_parent) => {
// let context = &executor.context();
// context.get_organe_at_uid(organe_parent)
// },
// }
// }
// field organe_parent_ref() -> Option<&str> {
// match &self.organe_parent {
// None => None,
// Some(ref s) => Some(s.as_str()),
// }
// }
// field uid() -> &str {
......@@ -355,7 +376,17 @@ graphql_object!(OrganeExterne: Context |&self| {
}
}
field organe_parent() -> Option<&str> {
field organe_parent(&executor) -> Option<&Organe> {
match &self.organe_parent {
None => None,
Some(ref organe_parent) => {
let context = &executor.context();
context.get_organe_at_uid(organe_parent)
},
}
}
field organe_parent_ref() -> Option<&str> {
match &self.organe_parent {
None => None,
Some(ref s) => Some(s.as_str()),
......@@ -430,7 +461,17 @@ graphql_object!(OrganeExtraParlementaire: Context |&self| {
}
}
field organe_parent() -> Option<&str> {
field organe_parent(&executor) -> Option<&Organe> {
match &self.organe_parent {
None => None,
Some(ref organe_parent) => {
let context = &executor.context();
context.get_organe_at_uid(organe_parent)
},
}
}
field organe_parent_ref() -> Option<&str> {
match &self.organe_parent {
None => None,
Some(ref s) => Some(s.as_str()),
......@@ -522,7 +563,17 @@ graphql_object!(OrganeParlementaire: Context |&self| {
}
}
field organe_parent() -> Option<&str> {
field organe_parent(&executor) -> Option<&Organe> {
match &self.organe_parent {
None => None,
Some(ref organe_parent) => {
let context = &executor.context();
context.get_organe_at_uid(organe_parent)
},
}
}
field organe_parent_ref() -> Option<&str> {
match &self.organe_parent {
None => None,
Some(ref s) => Some(s.as_str()),
......@@ -606,11 +657,24 @@ graphql_object!(OrganeParlementaireInternational: Context |&self| {
}
}
field liste_pays() -> &Option<ListePays> {
&self.liste_pays
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,
Some(ref organe_parent) => {
let context = &executor.context();
context.get_organe_at_uid(organe_parent)
},
}
}
field organe_parent() -> Option<&str> {
field organe_parent_ref() -> Option<&str> {
match &self.organe_parent {
None => None,
Some(ref s) => Some(s.as_str()),
......
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