Skip to content

Commit

Permalink
Merge pull request #9816 from mfo/US/api-chorus-configuration
Browse files Browse the repository at this point in the history
amelioration(api): ajoute la configuration chorus aux API GraphQL
  • Loading branch information
mfo authored Dec 11, 2023
2 parents adc005d + 643110c commit cf7e499
Show file tree
Hide file tree
Showing 5 changed files with 48 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
22 changes: 22 additions & 0 deletions app/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,23 @@ type CheckboxChampDescriptor implements ChampDescriptor {
type: TypeDeChamp! @deprecated(reason: "Utilisez le champ `__typename` à la place.")
}

type ChorusConfiguration {
"""
Le code du centre de cout auquel est rattaché la démarche.
"""
centreDeCout: String

"""
Le code du domaine fonctionnel auquel est rattaché la démarche.
"""
domaineFonctionnel: String

"""
Le code du référentiel de programmation auquel est rattaché la démarche..
"""
referentielDeProgrammation: String
}

enum Civilite {
"""
Monsieur
Expand Down Expand Up @@ -852,6 +869,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, String, "Le code du centre de cout auquel est rattaché la démarche.", null: true
field :domaine_fonctionnel, String, "Le code du domaine fonctionnel auquel est rattaché la démarche.", null: true
field :referentiel_de_programmation, String, "Le code du référentiel de programmation auquel est rattaché la démarche..", 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 @@ -1236,7 +1236,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 Coût', procedure.chorus_configuration.centre_de_cout&.fetch("code") { '' }]
]
end
columns += [
Expand Down

0 comments on commit cf7e499

Please sign in to comment.