Merge pull request #10642 from mfo/US/api.dossier_modifier_annotation_drop_down_list

Amélioration, ETQ consommateur de l'API graphql, je souhaite pouvoir modifier une annotation de type choix simple
This commit is contained in:
Paul Chavard 2024-07-30 08:25:05 +00:00 committed by GitHub
commit 4e180f8f05
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 144 additions and 2 deletions

View file

@ -894,6 +894,20 @@ class API::V2::StoredQuery
}
}
mutation dossierModifierAnnotationDropDownList(
$input: DossierModifierAnnotationDropDownListInput!
) {
dossierModifierAnnotationDropDownList(input: $input) {
annotation {
id
value: stringValue
}
errors {
message
}
}
}
mutation dossierModifierAnnotationIntegerNumber(
$input: DossierModifierAnnotationIntegerNumberInput!
) {

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 }
@ -65,6 +65,8 @@ module Mutations
TypeDeChamp.type_champs.fetch(:datetime)
when :integer_number
TypeDeChamp.type_champs.fetch(:integer_number)
when :drop_down_list
TypeDeChamp.type_champs.fetch(:drop_down_list)
end
end
end

View file

@ -0,0 +1,17 @@
module Mutations
class DossierModifierAnnotationDropDownList < Mutations::DossierModifierAnnotation
description "Modifier lannotation 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

View file

@ -1937,6 +1937,45 @@ type DossierModifierAnnotationDatetimePayload {
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
"""
@ -3278,6 +3317,16 @@ type Mutation {
input: DossierModifierAnnotationDatetimeInput!
): DossierModifierAnnotationDatetimePayload
"""
Modifier lannotation d'un champs de type dropdown list.
"""
dossierModifierAnnotationDropDownList(
"""
Parameters for DossierModifierAnnotationDropDownList
"""
input: DossierModifierAnnotationDropDownListInput!
): DossierModifierAnnotationDropDownListPayload
"""
Modifier lannotation au format nombre entier.
"""

View file

@ -19,6 +19,7 @@ module Types
field :dossier_modifier_annotation_datetime, mutation: Mutations::DossierModifierAnnotationDatetime
field :dossier_modifier_annotation_integer_number, mutation: Mutations::DossierModifierAnnotationIntegerNumber
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_creer, mutation: Mutations::GroupeInstructeurCreer