Merge pull request #8873 from tchak/fix-graphql-pending-deleted

fix(graphql): pendingDeletedSince should not crash
This commit is contained in:
Paul Chavard 2023-04-06 14:32:23 +00:00 committed by GitHub
commit 5f6df295ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -250,8 +250,8 @@ class Dossier < ApplicationRecord
scope :order_by_created_at, -> (order = :asc) { order(depose_at: order, created_at: order, id: order) }
scope :updated_since, -> (since) { where('dossiers.updated_at >= ?', since) }
scope :created_since, -> (since) { where('dossiers.depose_at >= ?', since) }
scope :hidden_by_user_since, -> (since) { where('dossiers.hidden_by_user_at NOT NULL AND dossiers.hidden_by_user_at >= ?', since) }
scope :hidden_by_administration_since, -> (since) { where('dossiers.hidden_by_administration_at NOT NULL AND dossiers.hidden_by_administration_at >= ?', since) }
scope :hidden_by_user_since, -> (since) { where('dossiers.hidden_by_user_at IS NOT NULL AND dossiers.hidden_by_user_at >= ?', since) }
scope :hidden_by_administration_since, -> (since) { where('dossiers.hidden_by_administration_at IS NOT NULL AND dossiers.hidden_by_administration_at >= ?', since) }
scope :hidden_since, -> (since) { hidden_by_user_since(since).or(hidden_by_administration_since(since)) }
scope :with_type_de_champ, -> (stable_id) {

View file

@ -135,7 +135,7 @@ describe API::V2::GraphqlController do
end
context 'include deleted Dossiers' do
let(:variables) { { demarcheNumber: procedure.id, includeDeletedDossiers: true } }
let(:variables) { { demarcheNumber: procedure.id, includeDeletedDossiers: true, deletedSince: 2.weeks.ago.iso8601 } }
let(:deleted_dossier) { create(:deleted_dossier, dossier: dossier_accepte) }
before { deleted_dossier }
@ -150,7 +150,7 @@ describe API::V2::GraphqlController do
end
context 'include pending deleted Dossiers' do
let(:variables) { { demarcheNumber: procedure.id, includePendingDeletedDossiers: true } }
let(:variables) { { demarcheNumber: procedure.id, includePendingDeletedDossiers: true, pendingDeletedSince: 2.weeks.ago.iso8601 } }
before {
dossier.hide_and_keep_track!(dossier.user, DeletedDossier.reasons.fetch(:user_request))