[graphql] Fix service field which can be nil

In `app/models/procedure.rb`, belongs_to service relation is optional.
To be consistent, service field in graphql has can be nil.
This commit is contained in:
Christophe Robillard 2022-06-14 15:58:25 +02:00
parent edf0687e1b
commit cb7e8d8a6e
2 changed files with 2 additions and 2 deletions

View file

@ -18,7 +18,7 @@ Cela évite laccès récursif aux dossiers."
field :date_fermeture, GraphQL::Types::ISO8601DateTime, "Date de la fermeture.", null: true field :date_fermeture, GraphQL::Types::ISO8601DateTime, "Date de la fermeture.", null: true
field :revision, Types::RevisionType, null: false field :revision, Types::RevisionType, null: false
field :service, Types::ServiceType, null: false field :service, Types::ServiceType, null: true
def service def service
Loaders::Record.for(Service).load(procedure.service_id) Loaders::Record.for(Service).load(procedure.service_id)

View file

@ -30,7 +30,7 @@ module Types
field :date_fermeture, GraphQL::Types::ISO8601DateTime, "Date de la fermeture.", null: true, method: :closed_at field :date_fermeture, GraphQL::Types::ISO8601DateTime, "Date de la fermeture.", null: true, method: :closed_at
field :groupe_instructeurs, [Types::GroupeInstructeurType], null: false field :groupe_instructeurs, [Types::GroupeInstructeurType], null: false
field :service, Types::ServiceType, null: false field :service, Types::ServiceType, null: true
field :dossiers, Types::DossierType.connection_type, "Liste de tous les dossiers dune démarche.", null: false do field :dossiers, Types::DossierType.connection_type, "Liste de tous les dossiers dune démarche.", null: false do
argument :order, Types::Order, default_value: :asc, required: false, description: "Lordre des dossiers." argument :order, Types::Order, default_value: :asc, required: false, description: "Lordre des dossiers."