[GraphQL]: do not return dossiers brouillons
This commit is contained in:
parent
990c867c2e
commit
fa741c9bae
2 changed files with 2 additions and 1 deletions
|
@ -39,7 +39,7 @@ module Types
|
||||||
end
|
end
|
||||||
|
|
||||||
def dossiers(updated_since: nil, created_since: nil, state: nil, order:)
|
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?
|
if state.present?
|
||||||
dossiers = dossiers.where(state: state)
|
dossiers = dossiers.where(state: state)
|
||||||
|
|
|
@ -14,6 +14,7 @@ describe API::V2::GraphqlController do
|
||||||
end
|
end
|
||||||
let(:dossier1) { create(:dossier, :en_construction, procedure: procedure, en_construction_at: 1.day.ago) }
|
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(: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(:dossiers) { [dossier2, dossier1, dossier] }
|
||||||
let(:instructeur) { create(:instructeur, followed_dossiers: dossiers) }
|
let(:instructeur) { create(:instructeur, followed_dossiers: dossiers) }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue