Merge pull request #10165 from mfo/US/add_champ_descriptor_id

feat(api): add champs.champDescriptorId so champRepetitions.rows[x] has a uniq id
This commit is contained in:
mfo 2024-03-21 17:05:56 +00:00 committed by GitHub
commit d00b146dc3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 110 additions and 0 deletions

View file

@ -490,6 +490,7 @@ class API::V2::StoredQuery
fragment ChampFragment on Champ { fragment ChampFragment on Champ {
id id
champDescriptorId
__typename __typename
label label
stringValue stringValue

View file

@ -72,6 +72,11 @@ type Address {
type AddressChamp implements Champ { type AddressChamp implements Champ {
address: Address address: Address
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
commune: Commune commune: Commune
departement: Departement departement: Departement
id: ID! id: ID!
@ -230,6 +235,10 @@ type COJOChampDescriptor implements ChampDescriptor {
} }
type CarteChamp implements Champ { type CarteChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
geoAreas: [GeoArea!]! geoAreas: [GeoArea!]!
id: ID! id: ID!
@ -279,6 +288,10 @@ type CarteChampDescriptor implements ChampDescriptor {
} }
interface Champ { interface Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
id: ID! id: ID!
""" """
@ -327,6 +340,10 @@ interface ChampDescriptor {
} }
type CheckboxChamp implements Champ { type CheckboxChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
id: ID! id: ID!
""" """
@ -405,6 +422,10 @@ enum Civilite {
} }
type CiviliteChamp implements Champ { type CiviliteChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
id: ID! id: ID!
""" """
@ -499,6 +520,10 @@ type Commune {
} }
type CommuneChamp implements Champ { type CommuneChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
commune: Commune commune: Commune
departement: Departement departement: Departement
id: ID! id: ID!
@ -639,6 +664,11 @@ type CreateDirectUploadPayload {
} }
type DateChamp implements Champ { type DateChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
""" """
La valeur du champ formaté en ISO8601 (Date). La valeur du champ formaté en ISO8601 (Date).
""" """
@ -696,6 +726,11 @@ type DateChampDescriptor implements ChampDescriptor {
} }
type DatetimeChamp implements Champ { type DatetimeChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
""" """
La valeur du champ formaté en ISO8601 (DateTime). La valeur du champ formaté en ISO8601 (DateTime).
""" """
@ -748,6 +783,10 @@ type DatetimeChampDescriptor implements ChampDescriptor {
} }
type DecimalNumberChamp implements Champ { type DecimalNumberChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
id: ID! id: ID!
""" """
@ -1239,6 +1278,10 @@ type Departement {
} }
type DepartementChamp implements Champ { type DepartementChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
departement: Departement departement: Departement
id: ID! id: ID!
@ -1677,6 +1720,10 @@ type DossierEnvoyerMessagePayload {
} }
type DossierLinkChamp implements Champ { type DossierLinkChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
dossier: Dossier dossier: Dossier
id: ID! id: ID!
@ -2212,6 +2259,11 @@ type EngagementJuridique {
} }
type EngagementJuridiqueChamp implements Champ { type EngagementJuridiqueChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
""" """
Montant engagé et payé de l'EJ. Montant engagé et payé de l'EJ.
""" """
@ -2315,6 +2367,10 @@ type Epci {
} }
type EpciChamp implements Champ { type EpciChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
departement: Departement departement: Departement
epci: Epci epci: Epci
id: ID! id: ID!
@ -2873,6 +2929,10 @@ type IbanChampDescriptor implements ChampDescriptor {
} }
type IntegerNumberChamp implements Champ { type IntegerNumberChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
id: ID! id: ID!
""" """
@ -2922,6 +2982,10 @@ type IntegerNumberChampDescriptor implements ChampDescriptor {
} }
type LinkedDropDownListChamp implements Champ { type LinkedDropDownListChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
id: ID! id: ID!
""" """
@ -3015,6 +3079,10 @@ type Message {
} }
type MultipleDropDownListChamp implements Champ { type MultipleDropDownListChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
id: ID! id: ID!
""" """
@ -3366,6 +3434,10 @@ type Pays {
} }
type PaysChamp implements Champ { type PaysChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
id: ID! id: ID!
""" """
@ -3487,6 +3559,10 @@ type PhoneChampDescriptor implements ChampDescriptor {
} }
type PieceJustificativeChamp implements Champ { type PieceJustificativeChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
file: File @deprecated(reason: "Utilisez le champ `files` à la place.") file: File @deprecated(reason: "Utilisez le champ `files` à la place.")
files: [File!]! files: [File!]!
id: ID! id: ID!
@ -3637,6 +3713,10 @@ type RNA {
} }
type RNAChamp implements Champ { type RNAChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
commune: Commune commune: Commune
departement: Departement departement: Departement
id: ID! id: ID!
@ -3694,6 +3774,10 @@ type RNF {
} }
type RNFChamp implements Champ { type RNFChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
commune: Commune commune: Commune
departement: Departement departement: Departement
id: ID! id: ID!
@ -3750,6 +3834,10 @@ type Region {
} }
type RegionChamp implements Champ { type RegionChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
id: ID! id: ID!
""" """
@ -3804,6 +3892,10 @@ type RegionChampDescriptor implements ChampDescriptor {
} }
type RepetitionChamp implements Champ { type RepetitionChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
champs: [Champ!]! @deprecated(reason: "Utilisez le champ `rows` à la place.") champs: [Champ!]! @deprecated(reason: "Utilisez le champ `rows` à la place.")
id: ID! id: ID!
@ -3906,6 +3998,10 @@ type Service {
} }
type SiretChamp implements Champ { type SiretChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
etablissement: PersonneMorale etablissement: PersonneMorale
id: ID! id: ID!
@ -3955,6 +4051,10 @@ type SiretChampDescriptor implements ChampDescriptor {
} }
type TextChamp implements Champ { type TextChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
id: ID! id: ID!
""" """
@ -4032,6 +4132,10 @@ type TextareaChampDescriptor implements ChampDescriptor {
} }
type TitreIdentiteChamp implements Champ { type TitreIdentiteChamp implements Champ {
"""
L'identifiant du champDescriptor de ce champ
"""
champDescriptorId: String!
filled: Boolean! filled: Boolean!
grantType: TitreIdentiteGrantType! grantType: TitreIdentiteGrantType!
id: ID! id: ID!

View file

@ -3,6 +3,7 @@ module Types
include Types::BaseInterface include Types::BaseInterface
global_id_field :id 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 :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 :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 field :updated_at, GraphQL::Types::ISO8601DateTime, "Date de dernière modification du champ.", null: false

View file

@ -134,6 +134,10 @@ class Champ < ApplicationRecord
:value :value
end end
def champ_descriptor_id
type_de_champ.to_typed_id
end
def to_typed_id def to_typed_id
if row_id.present? if row_id.present?
GraphQL::Schema::UniqueWithinType.encode('Champ', "#{stable_id}|#{row_id}") GraphQL::Schema::UniqueWithinType.encode('Champ', "#{stable_id}|#{row_id}")