feat(graphql): expose last_champ_updated_at and last_champ_private_updated_at on api

This commit is contained in:
Paul Chavard 2024-05-24 17:28:33 +02:00
parent 8431771a61
commit a8398a71b1
No known key found for this signature in database
3 changed files with 23 additions and 0 deletions

View file

@ -281,6 +281,8 @@ class API::V2::StoredQuery
dateExpiration
dateSuppressionParUsager
dateDerniereCorrectionEnAttente @include(if: $includeCorrections)
dateDerniereModificationChamps
dateDerniereModificationAnnotations
motivation
motivationAttachment {
...FileFragment

View file

@ -1418,6 +1418,16 @@ type Dossier {
"""
dateDerniereModification: ISO8601DateTime!
"""
Date de la dernière modification des annotations.
"""
dateDerniereModificationAnnotations: ISO8601DateTime!
"""
Date de la dernière modification des champs.
"""
dateDerniereModificationChamps: ISO8601DateTime!
"""
Date dexpiration.
"""

View file

@ -26,6 +26,9 @@ module Types
field :date_traitement, GraphQL::Types::ISO8601DateTime, "Date du dernier traitement.", null: true, method: :processed_at
field :date_derniere_modification, GraphQL::Types::ISO8601DateTime, "Date de la dernière modification.", null: false, method: :updated_at
field :date_derniere_modification_champs, GraphQL::Types::ISO8601DateTime, "Date de la dernière modification des champs.", null: false
field :date_derniere_modification_annotations, GraphQL::Types::ISO8601DateTime, "Date de la dernière modification des annotations.", null: false
field :date_suppression_par_usager, GraphQL::Types::ISO8601DateTime, "Date de la suppression par lusager.", null: true, method: :hidden_by_user_at
field :date_suppression_par_administration, GraphQL::Types::ISO8601DateTime, "Date de la suppression par ladministration.", null: true, method: :hidden_by_administration_at
field :date_expiration, GraphQL::Types::ISO8601DateTime, "Date dexpiration.", null: true
@ -89,6 +92,14 @@ module Types
Loaders::Association.for(object.class, :pending_correction).load(object).then { _1&.created_at }
end
def date_derniere_modification_champs
object.last_champ_updated_at || object.created_at
end
def date_derniere_modification_annotations
object.last_champ_private_updated_at || object.created_at
end
def connection_usager
if object.user_deleted?
:deleted