diff --git a/app/graphql/api/v2/stored_query.rb b/app/graphql/api/v2/stored_query.rb index 6991800d8..e04896f81 100644 --- a/app/graphql/api/v2/stored_query.rb +++ b/app/graphql/api/v2/stored_query.rb @@ -490,6 +490,7 @@ class API::V2::StoredQuery fragment ChampFragment on Champ { id + champDescriptorId __typename label stringValue diff --git a/app/graphql/schema.graphql b/app/graphql/schema.graphql index 5d746d012..ae37dadee 100644 --- a/app/graphql/schema.graphql +++ b/app/graphql/schema.graphql @@ -72,6 +72,11 @@ type Address { type AddressChamp implements Champ { address: Address + + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! commune: Commune departement: Departement id: ID! @@ -230,6 +235,10 @@ type COJOChampDescriptor implements ChampDescriptor { } type CarteChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! geoAreas: [GeoArea!]! id: ID! @@ -279,6 +288,10 @@ type CarteChampDescriptor implements ChampDescriptor { } interface Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! id: ID! """ @@ -327,6 +340,10 @@ interface ChampDescriptor { } type CheckboxChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! id: ID! """ @@ -405,6 +422,10 @@ enum Civilite { } type CiviliteChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! id: ID! """ @@ -499,6 +520,10 @@ type Commune { } type CommuneChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! commune: Commune departement: Departement id: ID! @@ -639,6 +664,11 @@ type CreateDirectUploadPayload { } type DateChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! + """ La valeur du champ formaté en ISO8601 (Date). """ @@ -696,6 +726,11 @@ type DateChampDescriptor implements ChampDescriptor { } type DatetimeChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! + """ La valeur du champ formaté en ISO8601 (DateTime). """ @@ -748,6 +783,10 @@ type DatetimeChampDescriptor implements ChampDescriptor { } type DecimalNumberChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! id: ID! """ @@ -1239,6 +1278,10 @@ type Departement { } type DepartementChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! departement: Departement id: ID! @@ -1677,6 +1720,10 @@ type DossierEnvoyerMessagePayload { } type DossierLinkChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! dossier: Dossier id: ID! @@ -2212,6 +2259,11 @@ type EngagementJuridique { } type EngagementJuridiqueChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! + """ Montant engagé et payé de l'EJ. """ @@ -2315,6 +2367,10 @@ type Epci { } type EpciChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! departement: Departement epci: Epci id: ID! @@ -2873,6 +2929,10 @@ type IbanChampDescriptor implements ChampDescriptor { } type IntegerNumberChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! id: ID! """ @@ -2922,6 +2982,10 @@ type IntegerNumberChampDescriptor implements ChampDescriptor { } type LinkedDropDownListChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! id: ID! """ @@ -3015,6 +3079,10 @@ type Message { } type MultipleDropDownListChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! id: ID! """ @@ -3366,6 +3434,10 @@ type Pays { } type PaysChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! id: ID! """ @@ -3487,6 +3559,10 @@ type PhoneChampDescriptor implements ChampDescriptor { } type PieceJustificativeChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! file: File @deprecated(reason: "Utilisez le champ `files` à la place.") files: [File!]! id: ID! @@ -3637,6 +3713,10 @@ type RNA { } type RNAChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! commune: Commune departement: Departement id: ID! @@ -3694,6 +3774,10 @@ type RNF { } type RNFChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! commune: Commune departement: Departement id: ID! @@ -3750,6 +3834,10 @@ type Region { } type RegionChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! id: ID! """ @@ -3804,6 +3892,10 @@ type RegionChampDescriptor implements ChampDescriptor { } type RepetitionChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! champs: [Champ!]! @deprecated(reason: "Utilisez le champ `rows` à la place.") id: ID! @@ -3906,6 +3998,10 @@ type Service { } type SiretChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! etablissement: PersonneMorale id: ID! @@ -3955,6 +4051,10 @@ type SiretChampDescriptor implements ChampDescriptor { } type TextChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! id: ID! """ @@ -4032,6 +4132,10 @@ type TextareaChampDescriptor implements ChampDescriptor { } type TitreIdentiteChamp implements Champ { + """ + L'identifiant du champDescriptor de ce champ + """ + champDescriptorId: String! filled: Boolean! grantType: TitreIdentiteGrantType! id: ID! diff --git a/app/graphql/types/champ_type.rb b/app/graphql/types/champ_type.rb index 8ad25d3b4..8b90f7065 100644 --- a/app/graphql/types/champ_type.rb +++ b/app/graphql/types/champ_type.rb @@ -3,6 +3,7 @@ module Types include Types::BaseInterface global_id_field :id + field :champ_descriptor_id, String, "L'identifiant du champDescriptor de ce champ", null: false field :label, String, "Libellé du champ.", null: false, method: :libelle field :string_value, String, "La valeur du champ sous forme texte.", null: true, method: :for_api_v2 field :updated_at, GraphQL::Types::ISO8601DateTime, "Date de dernière modification du champ.", null: false diff --git a/app/models/champ.rb b/app/models/champ.rb index f9a28afe9..8b1e7479a 100644 --- a/app/models/champ.rb +++ b/app/models/champ.rb @@ -134,6 +134,10 @@ class Champ < ApplicationRecord :value end + def champ_descriptor_id + type_de_champ.to_typed_id + end + def to_typed_id if row_id.present? GraphQL::Schema::UniqueWithinType.encode('Champ', "#{stable_id}|#{row_id}")