api(mutation.dossier_modifier_annotation_drop_down_list): add mutation to change drop_down_list annotations value
This commit is contained in:
parent
bf1a057ac3
commit
8e6c5d1567
6 changed files with 132 additions and 1 deletions
|
@ -894,6 +894,20 @@ class API::V2::StoredQuery
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mutation dossierModifierAnnotationDropDownList(
|
||||||
|
$input: DossierModifierAnnotationDropDownListInput!
|
||||||
|
) {
|
||||||
|
dossierModifierAnnotationDropDownList(input: $input) {
|
||||||
|
annotation {
|
||||||
|
id
|
||||||
|
value: stringValue
|
||||||
|
}
|
||||||
|
errors {
|
||||||
|
message
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mutation dossierModifierAnnotationIntegerNumber(
|
mutation dossierModifierAnnotationIntegerNumber(
|
||||||
$input: DossierModifierAnnotationIntegerNumberInput!
|
$input: DossierModifierAnnotationIntegerNumberInput!
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -65,6 +65,8 @@ module Mutations
|
||||||
TypeDeChamp.type_champs.fetch(:datetime)
|
TypeDeChamp.type_champs.fetch(:datetime)
|
||||||
when :integer_number
|
when :integer_number
|
||||||
TypeDeChamp.type_champs.fetch(:integer_number)
|
TypeDeChamp.type_champs.fetch(:integer_number)
|
||||||
|
when :drop_down_list
|
||||||
|
TypeDeChamp.type_champs.fetch(:drop_down_list)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
module Mutations
|
||||||
|
class DossierModifierAnnotationDropDownList < Mutations::DossierModifierAnnotation
|
||||||
|
description "Modifier l’annotation d'un champs de type dropdown list."
|
||||||
|
|
||||||
|
argument :value, GraphQL::Types::String, required: true
|
||||||
|
|
||||||
|
def resolve(dossier:, annotation_id:, instructeur:, value:)
|
||||||
|
resolve_with_type(dossier:, annotation_id:, instructeur:, value:)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def input_type
|
||||||
|
:drop_down_list
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1937,6 +1937,45 @@ type DossierModifierAnnotationDatetimePayload {
|
||||||
errors: [ValidationError!]
|
errors: [ValidationError!]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
Autogenerated input type of DossierModifierAnnotationDropDownList
|
||||||
|
"""
|
||||||
|
input DossierModifierAnnotationDropDownListInput {
|
||||||
|
"""
|
||||||
|
Annotation ID
|
||||||
|
"""
|
||||||
|
annotationId: ID!
|
||||||
|
|
||||||
|
"""
|
||||||
|
A unique identifier for the client performing the mutation.
|
||||||
|
"""
|
||||||
|
clientMutationId: String
|
||||||
|
|
||||||
|
"""
|
||||||
|
Dossier ID
|
||||||
|
"""
|
||||||
|
dossierId: ID!
|
||||||
|
|
||||||
|
"""
|
||||||
|
Instructeur qui demande la modification.
|
||||||
|
"""
|
||||||
|
instructeurId: ID!
|
||||||
|
value: String!
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
Autogenerated return type of DossierModifierAnnotationDropDownList.
|
||||||
|
"""
|
||||||
|
type DossierModifierAnnotationDropDownListPayload {
|
||||||
|
annotation: Champ
|
||||||
|
|
||||||
|
"""
|
||||||
|
A unique identifier for the client performing the mutation.
|
||||||
|
"""
|
||||||
|
clientMutationId: String
|
||||||
|
errors: [ValidationError!]
|
||||||
|
}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Autogenerated input type of DossierModifierAnnotationIntegerNumber
|
Autogenerated input type of DossierModifierAnnotationIntegerNumber
|
||||||
"""
|
"""
|
||||||
|
@ -3278,6 +3317,16 @@ type Mutation {
|
||||||
input: DossierModifierAnnotationDatetimeInput!
|
input: DossierModifierAnnotationDatetimeInput!
|
||||||
): DossierModifierAnnotationDatetimePayload
|
): DossierModifierAnnotationDatetimePayload
|
||||||
|
|
||||||
|
"""
|
||||||
|
Modifier l’annotation d'un champs de type dropdown list.
|
||||||
|
"""
|
||||||
|
dossierModifierAnnotationDropDownList(
|
||||||
|
"""
|
||||||
|
Parameters for DossierModifierAnnotationDropDownList
|
||||||
|
"""
|
||||||
|
input: DossierModifierAnnotationDropDownListInput!
|
||||||
|
): DossierModifierAnnotationDropDownListPayload
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Modifier l’annotation au format nombre entier.
|
Modifier l’annotation au format nombre entier.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -19,6 +19,7 @@ module Types
|
||||||
field :dossier_modifier_annotation_datetime, mutation: Mutations::DossierModifierAnnotationDatetime
|
field :dossier_modifier_annotation_datetime, mutation: Mutations::DossierModifierAnnotationDatetime
|
||||||
field :dossier_modifier_annotation_integer_number, mutation: Mutations::DossierModifierAnnotationIntegerNumber
|
field :dossier_modifier_annotation_integer_number, mutation: Mutations::DossierModifierAnnotationIntegerNumber
|
||||||
field :dossier_modifier_annotation_ajouter_ligne, mutation: Mutations::DossierModifierAnnotationAjouterLigne
|
field :dossier_modifier_annotation_ajouter_ligne, mutation: Mutations::DossierModifierAnnotationAjouterLigne
|
||||||
|
field :dossier_modifier_annotation_drop_down_list, mutation: Mutations::DossierModifierAnnotationDropDownList
|
||||||
|
|
||||||
field :groupe_instructeur_modifier, mutation: Mutations::GroupeInstructeurModifier
|
field :groupe_instructeur_modifier, mutation: Mutations::GroupeInstructeurModifier
|
||||||
field :groupe_instructeur_creer, mutation: Mutations::GroupeInstructeurCreer
|
field :groupe_instructeur_creer, mutation: Mutations::GroupeInstructeurCreer
|
||||||
|
|
|
@ -1230,9 +1230,13 @@ describe API::V2::GraphqlController do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'dossierModifierAnnotation' do
|
describe 'dossierModifierAnnotation' do
|
||||||
let(:procedure) { create(:procedure, :published, :for_individual, :with_service, :with_all_annotations, administrateurs: [admin]) }
|
let(:procedure) do
|
||||||
|
create(:procedure, :published, :for_individual, :with_service, administrateurs: [admin], types_de_champ_private:)
|
||||||
|
end
|
||||||
|
|
||||||
describe 'text' do
|
describe 'text' do
|
||||||
|
let(:types_de_champ_private) { [{ type: :text }] }
|
||||||
|
|
||||||
let(:query) do
|
let(:query) do
|
||||||
"mutation {
|
"mutation {
|
||||||
dossierModifierAnnotationText(input: {
|
dossierModifierAnnotationText(input: {
|
||||||
|
@ -1266,6 +1270,8 @@ describe API::V2::GraphqlController do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'checkbox' do
|
describe 'checkbox' do
|
||||||
|
let(:types_de_champ_private) { [{ type: :checkbox }] }
|
||||||
|
|
||||||
let(:value) { 'true' }
|
let(:value) { 'true' }
|
||||||
|
|
||||||
let(:query) do
|
let(:query) do
|
||||||
|
@ -1316,6 +1322,7 @@ describe API::V2::GraphqlController do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'yes_no' do
|
describe 'yes_no' do
|
||||||
|
let(:types_de_champ_private) { [{ type: :yes_no }] }
|
||||||
let(:value) { 'true' }
|
let(:value) { 'true' }
|
||||||
|
|
||||||
let(:query) do
|
let(:query) do
|
||||||
|
@ -1366,6 +1373,8 @@ describe API::V2::GraphqlController do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'date' do
|
describe 'date' do
|
||||||
|
let(:types_de_champ_private) { [{ type: :date }] }
|
||||||
|
|
||||||
let(:query) do
|
let(:query) do
|
||||||
"mutation {
|
"mutation {
|
||||||
dossierModifierAnnotationDate(input: {
|
dossierModifierAnnotationDate(input: {
|
||||||
|
@ -1399,6 +1408,8 @@ describe API::V2::GraphqlController do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'datetime' do
|
describe 'datetime' do
|
||||||
|
let(:types_de_champ_private) { [{ type: :datetime }] }
|
||||||
|
|
||||||
let(:query) do
|
let(:query) do
|
||||||
"mutation {
|
"mutation {
|
||||||
dossierModifierAnnotationDatetime(input: {
|
dossierModifierAnnotationDatetime(input: {
|
||||||
|
@ -1431,7 +1442,44 @@ describe API::V2::GraphqlController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'drop_down_list' do
|
||||||
|
let(:drop_down_list_options) { ['bijour'] }
|
||||||
|
let(:types_de_champ_private) { [{ type: :drop_down_list, options: drop_down_list_options }] }
|
||||||
|
let(:query) do
|
||||||
|
"mutation {
|
||||||
|
dossierModifierAnnotationDropDownList(input: {
|
||||||
|
dossierId: \"#{dossier.to_typed_id}\",
|
||||||
|
annotationId: \"#{dossier.champs_private.find { |c| c.type_champ == 'drop_down_list' }.to_typed_id}\",
|
||||||
|
instructeurId: \"#{instructeur.to_typed_id}\",
|
||||||
|
value: \"#{value}\"
|
||||||
|
}) {
|
||||||
|
annotation {
|
||||||
|
stringValue
|
||||||
|
}
|
||||||
|
errors {
|
||||||
|
message
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
end
|
||||||
|
|
||||||
|
context "success" do
|
||||||
|
let(:value) { drop_down_list_options.first }
|
||||||
|
it 'should be a success' do
|
||||||
|
expect(gql_errors).to eq(nil)
|
||||||
|
|
||||||
|
expect(gql_data).to eq(dossierModifierAnnotationDropDownList: {
|
||||||
|
annotation: {
|
||||||
|
stringValue: dossier.reload.champs_private.find { |c| c.type_champ == 'drop_down_list' }.to_s
|
||||||
|
},
|
||||||
|
errors: nil
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'integer_number' do
|
describe 'integer_number' do
|
||||||
|
let(:types_de_champ_private) { [{ type: :integer_number }] }
|
||||||
let(:query) do
|
let(:query) do
|
||||||
"mutation {
|
"mutation {
|
||||||
dossierModifierAnnotationIntegerNumber(input: {
|
dossierModifierAnnotationIntegerNumber(input: {
|
||||||
|
|
Loading…
Reference in a new issue