remove change on api V1 and update graphql for sensitive data

This commit is contained in:
Lisa Durand 2022-11-08 18:00:28 +01:00 committed by Paul Chavard
parent f34c890278
commit 3953470c78
4 changed files with 7 additions and 14 deletions

View file

@ -2085,6 +2085,7 @@ type TextChamp implements Champ {
}
type TitreIdentiteChamp implements Champ {
filled: Boolean!
grantType: TitreIdentiteGrantType!
id: ID!

View file

@ -8,9 +8,14 @@ module Types::Champs
end
field :grant_type, TitreIdentiteGrantTypeType, null: false
field :filled, Boolean, null: false
def grant_type
TypesDeChamp::TitreIdentiteTypeDeChamp::PIECE_JUSTIFICATIVE
end
def filled
object.piece_justificative_file.attached?
end
end
end

View file

@ -41,6 +41,6 @@ class Champs::TitreIdentiteChamp < Champ
end
def for_api
piece_justificative_file.attached? ? "présent" : "absent"
nil
end
end

View file

@ -11,17 +11,4 @@ describe Champs::TitreIdentiteChamp do
it { is_expected.to eq('absent') }
end
end
describe '#for_api' do
let(:champ_titre_identite) { create(:champ_titre_identite) }
subject { champ_titre_identite.for_api }
it { is_expected.to eq('présent') }
context 'without attached file' do
before { champ_titre_identite.piece_justificative_file.purge }
it { is_expected.to eq('absent') }
end
end
end