[GraphQL]: do not return dossiers brouillons

This commit is contained in:
Paul Chavard 2019-11-07 15:08:54 +01:00
parent 990c867c2e
commit fa741c9bae
2 changed files with 2 additions and 1 deletions

View file

@ -39,7 +39,7 @@ module Types
end
def dossiers(updated_since: nil, created_since: nil, state: nil, order:)
dossiers = object.dossiers.for_api_v2
dossiers = object.dossiers.state_not_brouillon.for_api_v2
if state.present?
dossiers = dossiers.where(state: state)

View file

@ -14,6 +14,7 @@ describe API::V2::GraphqlController do
end
let(:dossier1) { create(:dossier, :en_construction, procedure: procedure, en_construction_at: 1.day.ago) }
let(:dossier2) { create(:dossier, :en_construction, procedure: procedure, en_construction_at: 3.days.ago) }
let!(:dossier_brouillon) { create(:dossier, procedure: procedure) }
let(:dossiers) { [dossier2, dossier1, dossier] }
let(:instructeur) { create(:instructeur, followed_dossiers: dossiers) }