feat(graphql): expose sva/svr dates

This commit is contained in:
Colin Darie 2023-07-26 13:53:30 +02:00
parent 019392c127
commit ea7d3f9364
No known key found for this signature in database
GPG key ID: 8C76CADD40253590
3 changed files with 44 additions and 0 deletions

View file

@ -1348,6 +1348,11 @@ type Dossier {
"""
datePassageEnInstruction: ISO8601DateTime
"""
Date prévisionnelle de décision automatique par le SVA/SVR.
"""
datePrevisionnelleDecisionSVASVR: ISO8601Date
"""
Date de la suppression par ladministration.
"""
@ -1362,6 +1367,11 @@ type Dossier {
Date du dernier traitement.
"""
dateTraitement: ISO8601DateTime
"""
Date du traitement automatique par le SVA/SVR.
"""
dateTraitementSVASVR: ISO8601DateTime
demandeur: Demandeur!
demarche: DemarcheDescriptor!

View file

@ -32,6 +32,9 @@ module Types
field :date_derniere_correction_en_attente, GraphQL::Types::ISO8601DateTime, "Date de la dernière demande de correction qui na pas encore été traitée par lusager.", null: true
field :date_previsionnelle_decision_sva_svr, GraphQL::Types::ISO8601Date, "Date prévisionnelle de décision automatique par le SVA/SVR.", null: true, method: :sva_svr_decision_on
field :date_traitement_sva_svr, GraphQL::Types::ISO8601DateTime, "Date du traitement automatique par le SVA/SVR.", null: true, method: :sva_svr_decision_triggered_at
field :archived, Boolean, null: false
field :connection_usager, ConnectionUsager, null: false

View file

@ -257,6 +257,28 @@ RSpec.describe Types::DossierType, type: :graphql do
}
end
describe 'dossier on sva procedure' do
let(:procedure) { create(:procedure, :sva) }
let(:query) { DOSSIER_WITH_SVA_QUERY }
let(:variables) { { number: dossier.id } }
context 'dossier en_instruction' do
let(:dossier) { create(:dossier, :en_instruction, procedure:, sva_svr_decision_on: 3.days.from_now.to_date) }
it {
expect(data[:dossier][:datePrevisionnelleDecisionSVASVR]).not_to be_nil
}
end
context 'dossier accepte' do
let(:dossier) { create(:dossier, :accepte, procedure:, sva_svr_decision_triggered_at: 24.hours.ago) }
it {
expect(data[:dossier][:dateTraitementSVASVR]).not_to be_nil
}
end
end
DOSSIER_QUERY = <<-GRAPHQL
query($number: Int!) {
dossier(number: $number) {
@ -440,6 +462,15 @@ RSpec.describe Types::DossierType, type: :graphql do
}
GRAPHQL
DOSSIER_WITH_SVA_QUERY = <<-GRAPHQL
query($number: Int!) {
dossier(number: $number) {
datePrevisionnelleDecisionSVASVR
dateTraitementSVASVR
}
}
GRAPHQL
DOSSIER_WITH_SELECTED_CHAMP_QUERY = <<-GRAPHQL
query($number: Int!, $id: ID!) {
dossier(number: $number) {