Skip to content

Commit

Permalink
amelioration(api): ajoute la configuration chorus aux API GraphQL
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin committed Dec 7, 2023
1 parent f27ef80 commit de77f6a
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/graphql/api/v2/stored_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ def self.get(query_id)
declarative
dateCreation
dateFermeture
chorusConfiguration {
centreDeCout
domaineFonctionnel
referentielDeProgrammation
}
activeRevision @include(if: $includeRevision) {
...RevisionFragment
}
Expand Down
11 changes: 11 additions & 0 deletions app/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,12 @@ type CheckboxChampDescriptor implements ChampDescriptor {
type: TypeDeChamp! @deprecated(reason: "Utilisez le champ `__typename` à la place.")
}

type ChorusConfiguration {
centreDeCout: String
domaineFonctionnel: String
referentielDeProgrammation: String
}

enum Civilite {
"""
Monsieur
Expand Down Expand Up @@ -852,6 +858,11 @@ type Demarche {
annotationDescriptors: [ChampDescriptor!]! @deprecated(reason: "Utilisez le champ `activeRevision.annotationDescriptors` à la place.")
champDescriptors: [ChampDescriptor!]! @deprecated(reason: "Utilisez le champ `activeRevision.champDescriptors` à la place.")

"""
Cadre budgétaire Chorus
"""
chorusConfiguration: ChorusConfiguration

"""
Date de la création.
"""
Expand Down
19 changes: 19 additions & 0 deletions app/graphql/types/chorus_configuration_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module Types
class ChorusConfigurationType < Types::BaseObject
field :centre_de_cout, "Le code du centre de cout auquel est rattaché la démarche.", String, null: true
field :domaine_fonctionnel, "Le code du domaine fonctionnel auquel est rattaché la démarche.", String, null: true
field :referentiel_de_programmation, "Le code du référentiel de programmation auquel est rattaché la démarche..", String, null: true

def centre_de_cout
object.centre_de_cout&.fetch("code") { '' }
end

def domaine_fonctionnel
object.domaine_fonctionnel&.fetch("code") { '' }
end

def referentiel_de_programmation
object.referentiel_de_programmation&.fetch("code") { '' }
end
end
end
1 change: 1 addition & 0 deletions app/graphql/types/demarche_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class DossierDeclarativeState < Types::BaseEnum
field :draft_revision, Types::RevisionType, null: false
field :published_revision, Types::RevisionType, null: true
field :revisions, [Types::RevisionType], null: false
field :chorus_configuration, Types::ChorusConfigurationType, null: true, description: "Cadre budgétaire Chorus"

def state
object.aasm.current_state
Expand Down
2 changes: 1 addition & 1 deletion app/models/dossier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,7 @@ def spreadsheet_columns(with_etablissement: false, types_de_champ:)
columns += [
['Domaine Fonctionnel', procedure.chorus_configuration.domaine_fonctionnel&.fetch("code") { '' }],
['Référentiel De Programmation', procedure.chorus_configuration.referentiel_de_programmation&.fetch("code") { '' }],
['Centre De Coup', procedure.chorus_configuration.centre_de_cout&.fetch("code") { '' }]
['Centre De Cout', procedure.chorus_configuration.centre_de_cout&.fetch("code") { '' }]
]
end
columns += [
Expand Down

0 comments on commit de77f6a

Please sign in to comment.