Commit c0cb9363 authored by Emmanuel Raviart's avatar Emmanuel Raviart

Add context to "actes" & "dossiers".

parent 2c8788b8
Pipeline #98966 failed with stage
in 1 minute and 10 seconds
This diff is collapsed.
use chrono::{Date, FixedOffset};
use std::cmp;
use actes_legislatifs::{ActeLegislatif, ActesLegislatifs, Initiateur};
use chrono::{Date, FixedOffset};
use commun::{CodeEtLibelle, Indexation, Rapporteur, XmlNamespace};
use contexts::Context;
use serde_utils::map_to_vec;
use std::cmp;
use textes_legislatifs::TextesLegislatifs;
#[derive(Clone, Copy, Debug, Deserialize, GraphQLEnum)]
......@@ -14,14 +14,20 @@ pub enum CauseFusionDossier {
ExamenCommun,
}
#[derive(Debug, Deserialize, GraphQLObject)]
#[derive(Debug, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Dossier {
#[serde(rename = "dossierParlementaire")]
pub dossier_parlementaire: DossierParlementaire,
}
#[derive(Debug, Deserialize, GraphQLObject)]
graphql_object!(Dossier: Context |&self| {
field dossier_parlementaire() -> &DossierParlementaire {
&self.dossier_parlementaire
}
});
#[derive(Debug, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct DossierCommissionEnquete {
#[serde(rename = "actesLegislatifs")]
......@@ -38,7 +44,41 @@ pub struct DossierCommissionEnquete {
pub uid: String,
}
#[derive(Debug, Deserialize, GraphQLObject)]
graphql_object!(DossierCommissionEnquete: Context |&self| {
field actes_legislatifs() -> &ActesLegislatifs {
&self.actes_legislatifs
}
field fusion_dossier() -> &Option<FusionDossier> {
&self.fusion_dossier
}
field indexation() -> &Option<Indexation> {
&self.indexation
}
field initiateur() -> &Option<Initiateur> {
&self.initiateur
}
field legislature() -> &str {
&self.legislature
}
field procedure_parlementaire() -> &ProcedureParlementaire {
&self.procedure_parlementaire
}
field titre_dossier() -> &TitreDossier {
&self.titre_dossier
}
field uid() -> &str {
&self.uid
}
});
#[derive(Debug, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct DossierInitiativeExecutif {
#[serde(rename = "actesLegislatifs")]
......@@ -55,7 +95,41 @@ pub struct DossierInitiativeExecutif {
pub uid: String,
}
#[derive(Debug, Deserialize, GraphQLObject)]
graphql_object!(DossierInitiativeExecutif: Context |&self| {
field actes_legislatifs() -> &ActesLegislatifs {
&self.actes_legislatifs
}
field fusion_dossier() -> &Option<FusionDossier> {
&self.fusion_dossier
}
field indexation() -> &Option<Indexation> {
&self.indexation
}
field initiateur() -> &Option<Initiateur> {
&self.initiateur
}
field legislature() -> &str {
&self.legislature
}
field procedure_parlementaire() -> &ProcedureParlementaire {
&self.procedure_parlementaire
}
field titre_dossier() -> &TitreDossier {
&self.titre_dossier
}
field uid() -> &str {
&self.uid
}
});
#[derive(Debug, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct DossierLegislatif {
#[serde(rename = "actesLegislatifs")]
......@@ -74,7 +148,45 @@ pub struct DossierLegislatif {
pub uid: String,
}
#[derive(Debug, Deserialize, GraphQLObject)]
graphql_object!(DossierLegislatif: Context |&self| {
field actes_legislatifs() -> &ActesLegislatifs {
&self.actes_legislatifs
}
field fusion_dossier() -> &Option<FusionDossier> {
&self.fusion_dossier
}
field indexation() -> &Option<Indexation> {
&self.indexation
}
field initiateur() -> &Option<Initiateur> {
&self.initiateur
}
field legislature() -> &str {
&self.legislature
}
field plf() -> &Option<Plf> {
&self.plf
}
field procedure_parlementaire() -> &ProcedureParlementaire {
&self.procedure_parlementaire
}
field titre_dossier() -> &TitreDossier {
&self.titre_dossier
}
field uid() -> &str {
&self.uid
}
});
#[derive(Debug, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct DossierMissionControle {
#[serde(rename = "actesLegislatifs")]
......@@ -91,7 +203,41 @@ pub struct DossierMissionControle {
pub uid: String,
}
#[derive(Debug, Deserialize, GraphQLObject)]
graphql_object!(DossierMissionControle: Context |&self| {
field actes_legislatifs() -> &ActesLegislatifs {
&self.actes_legislatifs
}
field fusion_dossier() -> &Option<FusionDossier> {
&self.fusion_dossier
}
field indexation() -> &Option<Indexation> {
&self.indexation
}
field initiateur() -> &Option<Initiateur> {
&self.initiateur
}
field legislature() -> &str {
&self.legislature
}
field procedure_parlementaire() -> &ProcedureParlementaire {
&self.procedure_parlementaire
}
field titre_dossier() -> &TitreDossier {
&self.titre_dossier
}
field uid() -> &str {
&self.uid
}
});
#[derive(Debug, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct DossierMissionInformation {
#[serde(rename = "actesLegislatifs")]
......@@ -108,6 +254,40 @@ pub struct DossierMissionInformation {
pub uid: String,
}
graphql_object!(DossierMissionInformation: Context |&self| {
field actes_legislatifs() -> &ActesLegislatifs {
&self.actes_legislatifs
}
field fusion_dossier() -> &Option<FusionDossier> {
&self.fusion_dossier
}
field indexation() -> &Option<Indexation> {
&self.indexation
}
field initiateur() -> &Option<Initiateur> {
&self.initiateur
}
field legislature() -> &str {
&self.legislature
}
field procedure_parlementaire() -> &ProcedureParlementaire {
&self.procedure_parlementaire
}
field titre_dossier() -> &TitreDossier {
&self.titre_dossier
}
field uid() -> &str {
&self.uid
}
});
#[derive(Debug, Deserialize)]
#[serde(tag = "@xsi:type")]
pub enum DossierParlementaire {
......@@ -461,7 +641,7 @@ impl PartialEq for DossierParlementaire {
// Using graphql_union because instance_resolvers of graphql_interface does not work with Juniper 0.9.2.
// graphql_interface!(DossierParlementaire: () |&self| {
graphql_union!(DossierParlementaire: () |&self| {
graphql_union!(DossierParlementaire: Context |&self| {
// field actes_legislatifs() -> &ActesLegislatifs {
// self.actes_legislatifs()
// }
......@@ -526,7 +706,7 @@ graphql_union!(DossierParlementaire: () |&self| {
}
});
#[derive(Debug, Deserialize, GraphQLObject)]
#[derive(Debug, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct DossierResolutionAN {
#[serde(rename = "actesLegislatifs")]
......@@ -543,7 +723,41 @@ pub struct DossierResolutionAN {
pub uid: String,
}
#[derive(Debug, Deserialize, GraphQLObject)]
graphql_object!(DossierResolutionAN: Context |&self| {
field actes_legislatifs() -> &ActesLegislatifs {
&self.actes_legislatifs
}
field fusion_dossier() -> &Option<FusionDossier> {
&self.fusion_dossier
}
field indexation() -> &Option<Indexation> {
&self.indexation
}
field initiateur() -> &Option<Initiateur> {
&self.initiateur
}
field legislature() -> &str {
&self.legislature
}
field procedure_parlementaire() -> &ProcedureParlementaire {
&self.procedure_parlementaire
}
field titre_dossier() -> &TitreDossier {
&self.titre_dossier
}
field uid() -> &str {
&self.uid
}
});
#[derive(Debug, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct DossierSansType {
#[serde(rename = "actesLegislatifs")]
......@@ -560,6 +774,40 @@ pub struct DossierSansType {
pub uid: String,
}
graphql_object!(DossierSansType: Context |&self| {
field actes_legislatifs() -> &ActesLegislatifs {
&self.actes_legislatifs
}
field fusion_dossier() -> &Option<FusionDossier> {
&self.fusion_dossier
}
field indexation() -> &Option<Indexation> {
&self.indexation
}
field initiateur() -> &Option<Initiateur> {
&self.initiateur
}
field legislature() -> &str {
&self.legislature
}
field procedure_parlementaire() -> &ProcedureParlementaire {
&self.procedure_parlementaire
}
field titre_dossier() -> &TitreDossier {
&self.titre_dossier
}
field uid() -> &str {
&self.uid
}
});
#[derive(Debug, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct DossiersLegislatifs {
......
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