Commit 1ce10153 authored by Emmanuel Raviart's avatar Emmanuel Raviart

Add informations for "signataires" of "amendements".

parent 5e386484
Pipeline #99873 passed with stage
in 2 minutes and 14 seconds
use acteurs::Acteur;
use commun::{EmptyChoice, XmlNamespace};
use contexts::Context;
use organes::Organe;
use serde_utils::{map_to_vec, str_to_bool, str_to_option_bool, str_to_vec};
use textes_legislatifs::Document;
......@@ -334,7 +335,7 @@ pub struct Auteur {
#[serde(rename = "organeRef")]
pub organe_ref: Option<String>,
#[serde(rename = "typeAuteur")]
pub type_auteur: Option<String>,
pub type_auteur: TypeAuteur,
}
graphql_object!(Auteur: Context |&self| {
......@@ -355,6 +356,16 @@ graphql_object!(Auteur: Context |&self| {
}
}
field groupe_politique(&executor) -> Option<&Organe> {
match &self.groupe_politique_ref {
None => None,
Some(ref groupe_politique_ref) => {
let context = &executor.context();
context.get_organe_at_uid(groupe_politique_ref)
},
}
}
field groupe_politique_ref() -> Option<&str> {
match &self.groupe_politique_ref {
None => None,
......@@ -362,19 +373,26 @@ graphql_object!(Auteur: Context |&self| {
}
}
field organe_ref() -> Option<&str> {
field organe(&executor) -> Option<&Organe> {
match &self.organe_ref {
None => None,
Some(ref s) => Some(s.as_str()),
Some(ref organe_ref) => {
let context = &executor.context();
context.get_organe_at_uid(organe_ref)
},
}
}
field type_auteur() -> Option<&str> {
match &self.type_auteur {
field organe_ref() -> Option<&str> {
match &self.organe_ref {
None => None,
Some(ref s) => Some(s.as_str()),
}
}
field type_auteur() -> TypeAuteur {
self.type_auteur
}
});
#[derive(Debug, Deserialize, GraphQLObject)]
......@@ -708,6 +726,16 @@ pub struct TotalMontants {
pub solde: Option<String>,
}
#[derive(Clone, Copy, Debug, Deserialize, GraphQLEnum)]
pub enum TypeAuteur {
#[graphql(name = "Depute")]
Depute,
#[graphql(name = "Gouvernement")]
Gouvernement,
#[graphql(name = "Rapporteur")]
Rapporteur,
}
#[derive(Debug, Deserialize, GraphQLObject)]
#[serde(deny_unknown_fields)]
pub struct TypeMime {
......
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