Expose declarative démarche state in GraphQL

This commit is contained in:
Paul Chavard 2019-12-04 12:07:21 +01:00
parent e429c79eb1
commit 34afc44813
2 changed files with 26 additions and 0 deletions

View file

@ -184,6 +184,11 @@ type Demarche {
"""
datePublication: ISO8601DateTime!
"""
L'état de dossier pour une démarche déclarative
"""
declarative: DossierDeclarativeState
"""
Description de la démarche.
"""
@ -428,6 +433,18 @@ type DossierConnection {
pageInfo: PageInfo!
}
enum DossierDeclarativeState {
"""
Accepté
"""
accepte
"""
En instruction
"""
en_instruction
}
"""
An edge in a connection.
"""

View file

@ -6,6 +6,14 @@ module Types
end
end
class DossierDeclarativeState < Types::BaseEnum
Procedure.declarative_with_states.each do |symbol_name, string_name|
value(string_name,
I18n.t("declarative_with_state/#{string_name}", scope: [:activerecord, :attributes, :procedure]),
value: symbol_name)
end
end
description "Une demarche"
global_id_field :id
@ -13,6 +21,7 @@ module Types
field :title, String, "Le titre de la démarche.", null: false, method: :libelle
field :description, String, "Description de la démarche.", null: false
field :state, DemarcheState, "L'état de la démarche.", null: false
field :declarative, DossierDeclarativeState, "L'état de dossier pour une démarche déclarative", null: true, method: :declarative_with_state
field :date_creation, GraphQL::Types::ISO8601DateTime, "Date de la création.", null: false, method: :created_at
field :date_publication, GraphQL::Types::ISO8601DateTime, "Date de la publication.", null: false, method: :published_at