demarches-normaliennes/app/graphql/mutations/dossier_modifier_annotation_checkbox.rb
Sébastien Carceles fa6fc077b4
normalize boolean values (#8320)
* extract parent for yes no and checkbox champs

* checkbox stores true / false instead of on / off

* normalize blank value to nil

* normalize invalid value to false

* after party task: normalize checkbox values

* after party task: normalize yes_no values
2023-01-05 11:18:27 +00:00

19 lines
474 B
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

module Mutations
class DossierModifierAnnotationCheckbox < Mutations::DossierModifierAnnotation
description "Modifier lannotation au format oui/non."
argument :value, Boolean, required: true
def resolve(dossier:, annotation_id:, instructeur:, value:)
resolve_with_type(dossier:, annotation_id:, instructeur:, value:) do |_, value|
value ? 'true' : 'false'
end
end
private
def input_type
:checkbox
end
end
end