Si vous constatez la perte de tickets, de commentaires ou de projets, veuillez consulter la page

Commit 562e35cf authored by Emmanuel Raviart's avatar Emmanuel Raviart

Add GraphQL API "statut" to give informations on the server and its data.

parent 2f1341f5
......@@ -2,6 +2,7 @@ use acteurs::Acteur;
use acteurs_et_organes;
use agendas::{self, Reunion};
use amendements::{self, Amendement, TexteLeg};
use chrono::{DateTime, Utc};
use dossiers_legislatifs::{self, DossierParlementaire};
use juniper;
use organes::Organe;
......@@ -27,6 +28,7 @@ pub struct Context {
pub reunions_by_dossier_uid: HashMap<String, Vec<*const Reunion>>,
pub scrutin_by_uid: HashMap<String, *const Scrutin>,
pub scrutins_wrappers: Vec<scrutins::ScrutinsJsonWrapper>,
pub statut: Statut,
pub texte_leg_by_uid: HashMap<String, *const TexteLeg>,
......@@ -125,3 +127,8 @@ impl Context {
unsafe impl Send for Context {}
unsafe impl Sync for Context {}
impl juniper::Context for Context {}
#[derive(Debug, Deserialize, GraphQLObject)]
pub struct Statut {
pub date_mise_a_jour_donnees: DateTime<Utc>,
......@@ -35,8 +35,9 @@ mod types_organes;
pub use acteurs::Acteur;
pub use agendas::Reunion;
pub use amendements::{Amendement, TexteLeg, TextesEtAmendements};
use chrono::prelude::Utc;
use config::{Config, Verbosity};
pub use contexts::Context;
pub use contexts::{Context, Statut};
pub use dossiers_legislatifs::DossierParlementaire;
pub use mandats::Mandat;
pub use organes::Organe;
......@@ -403,6 +404,9 @@ pub fn load(
statut: Statut {
date_mise_a_jour_donnees: Utc::now(),
......@@ -15,12 +15,12 @@ extern crate serde_json;
extern crate tricoteuses_api_assemblee_config as config;
extern crate tricoteuses_api_assemblee_data as data;
use chrono::*;
use chrono::prelude::*;
use clap::{App, Arg};
use config::Verbosity;
use data::{
Acteur, Amendement, CodeTypeOrgane, Context, Document, DossierParlementaire, FonctionOrgane,
Mandat, Organe, Reunion, Scrutin, TexteLeg, TextesEtAmendements, ALL_DATASETS,
Mandat, Organe, Reunion, Scrutin, Statut, TexteLeg, TextesEtAmendements, ALL_DATASETS,
use juniper::{EmptyMutation, FieldResult, RootNode};
......@@ -495,6 +495,10 @@ graphql_object!(Query: Context |&self| {
field statut(&executor) -> FieldResult<&Statut> {
field textes_et_amendements(&executor) -> FieldResult<Vec<&TextesEtAmendements>> {
let mut textes_et_amendements: Vec<&TextesEtAmendements> = Vec::new();
for wrapper in &executor.context().amendements_wrappers{
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