From 62b706dff6f5d6608bfc56beb2301a5716661c83 Mon Sep 17 00:00:00 2001 From: Eric Leroy-Terquem Date: Fri, 27 Oct 2023 14:22:00 +0200 Subject: [PATCH] feat(graphql): add rnf_champ to graphql api --- app/graphql/api/v2/schema.rb | 1 + app/graphql/schema.graphql | 33 +++++++++++++++++++ app/graphql/types/champ_descriptor_type.rb | 2 ++ .../descriptor/rnf_champ_descriptor_type.rb | 5 +++ 4 files changed, 41 insertions(+) create mode 100644 app/graphql/types/champs/descriptor/rnf_champ_descriptor_type.rb diff --git a/app/graphql/api/v2/schema.rb b/app/graphql/api/v2/schema.rb index 867a36126d0..ba90e45fbc1 100644 --- a/app/graphql/api/v2/schema.rb +++ b/app/graphql/api/v2/schema.rb @@ -110,6 +110,7 @@ def self.resolve_type(type_definition, object, ctx) Types::Champs::Descriptor::RegionChampDescriptorType, Types::Champs::Descriptor::RepetitionChampDescriptorType, Types::Champs::Descriptor::RNAChampDescriptorType, + Types::Champs::Descriptor::RNFChampDescriptorType, Types::Champs::Descriptor::SiretChampDescriptorType, Types::Champs::Descriptor::TextareaChampDescriptorType, Types::Champs::Descriptor::TextChampDescriptorType, diff --git a/app/graphql/schema.graphql b/app/graphql/schema.graphql index 404457cd6ee..72718abedd8 100644 --- a/app/graphql/schema.graphql +++ b/app/graphql/schema.graphql @@ -3535,6 +3535,34 @@ type RNAChampDescriptor implements ChampDescriptor { type: TypeDeChamp! @deprecated(reason: "Utilisez le champ `__typename` à la place.") } +type RNFChampDescriptor implements ChampDescriptor { + """ + Description des champs d’un bloc répétable. + """ + champDescriptors: [ChampDescriptor!] @deprecated(reason: "Utilisez le champ `RepetitionChampDescriptor.champ_descriptors` à la place.") + + """ + Description du champ. + """ + description: String + id: ID! + + """ + Libellé du champ. + """ + label: String! + + """ + Est-ce que le champ est obligatoire ? + """ + required: Boolean! + + """ + Type de la valeur du champ. + """ + type: TypeDeChamp! @deprecated(reason: "Utilisez le champ `__typename` à la place.") +} + type Region { code: String! name: String! @@ -4053,6 +4081,11 @@ enum TypeDeChamp { """ rna + """ + RNF + """ + rnf + """ Numéro Siret """ diff --git a/app/graphql/types/champ_descriptor_type.rb b/app/graphql/types/champ_descriptor_type.rb index 6bc69823d4d..44563b1024e 100644 --- a/app/graphql/types/champ_descriptor_type.rb +++ b/app/graphql/types/champ_descriptor_type.rb @@ -72,6 +72,8 @@ def resolve_type(object, context) Types::Champs::Descriptor::PieceJustificativeChampDescriptorType when TypeDeChamp.type_champs.fetch(:rna) Types::Champs::Descriptor::RNAChampDescriptorType + when TypeDeChamp.type_champs.fetch(:rnf) + Types::Champs::Descriptor::RNFChampDescriptorType when TypeDeChamp.type_champs.fetch(:carte) Types::Champs::Descriptor::CarteChampDescriptorType when TypeDeChamp.type_champs.fetch(:repetition) diff --git a/app/graphql/types/champs/descriptor/rnf_champ_descriptor_type.rb b/app/graphql/types/champs/descriptor/rnf_champ_descriptor_type.rb new file mode 100644 index 00000000000..0b0968e2743 --- /dev/null +++ b/app/graphql/types/champs/descriptor/rnf_champ_descriptor_type.rb @@ -0,0 +1,5 @@ +module Types::Champs::Descriptor + class RNFChampDescriptorType < Types::BaseObject + implements Types::ChampDescriptorType + end +end