Commit c09d920a authored by Nelson Herbin's avatar Nelson Herbin

add feature: amendement field for searching a single amendement based on its uid

parent a19a631f
......@@ -198,7 +198,26 @@ graphql_object!(Query: Context |&self| {
Ok(reunions)
}
field amendements(&executor, since: Option<String>, until: Option<String>) -> FieldResult<Vec<&Amendement>> {
field amendement(&executor, id: String as "Identifiant (uid) de l'amendement recherché") -> FieldResult<Option<&Amendement>> as "Rechercher un amendement par son identifiant" {
let mut amendement: Option<&Amendement> = None;
for wrapper in &executor.context().amendements_wrappers{
for texteleg in &wrapper.textes_et_amendements{
for txtleg in &texteleg.texteleg{
for amds in &txtleg.amendements{
for amd in &amds.amendements{
if &amd.uid == &id {
amendement = Some(&amd)
}
}
}
}
}
}
Ok(amendement)
}
field amendements(&executor, since: Option<String> as "Date de départ de la recherche des amendements, au format YYYY-MM-DD", until: Option<String> as "Date limite de la recherche des amendements, au format YYYY-MM-DD") -> FieldResult<Vec<&Amendement>> as "Obtenir la liste des amendements, optionnellement en fournissant une date de départ et une date de fin pour la recherche."{
let mut amendements: Vec<&Amendement> = Vec::new();
let parse_from_str = NaiveDate::parse_from_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