Merge pull request #10455 from tchak/feat-graphql-timestamps

feat(graphql): expose last_champ_updated_at and last_champ_private_updated_at on api
This commit is contained in:
Paul Chavard 2024-05-30 13:42:57 +00:00 committed by GitHub
commit 8273870a2c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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