feat(api.dossier.modifier_annotation): stop validation only with graphql schema, also validate with our validations methods

This commit is contained in:
mfo 2024-07-24 17:48:00 +02:00
parent 8e6c5d1567
commit e63b777bd9
No known key found for this signature in database
GPG key ID: 7CE3E1F5B794A8EC
2 changed files with 12 additions and 1 deletions

View file

@ -20,7 +20,7 @@ module Mutations
annotation.value = value
end
if annotation.save
if annotation.validate(:champs_private_value) && annotation.save
{ annotation: }
else
{ errors: annotation.errors.full_messages }

View file

@ -1476,6 +1476,17 @@ describe API::V2::GraphqlController do
})
end
end
context "failure" do
let(:value) { drop_down_list_options.first.reverse }
it 'should be a success' do
expect(gql_errors).to eq(nil)
expect(gql_data).to eq(dossierModifierAnnotationDropDownList: {
annotation: nil,
errors: [{ message: "doit être dans les options proposées" }]
})
end
end
end
describe 'integer_number' do