Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amelioration(api): ajoute la configuration chorus aux API GraphQL #9816

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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 Coût', procedure.chorus_configuration.centre_de_cout&.fetch("code") { '' }]
]
end
columns += [
Expand Down