From 03ddd17884e73eaf549884afb25ac23c319a113a Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 26 Jan 2021 14:31:01 +0100 Subject: [PATCH 1/2] Ignore entreprise_id on etablissements --- app/models/etablissement.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/etablissement.rb b/app/models/etablissement.rb index d4916c087..c4532915c 100644 --- a/app/models/etablissement.rb +++ b/app/models/etablissement.rb @@ -48,6 +48,8 @@ # entreprise_id :integer # class Etablissement < ApplicationRecord + self.ignored_columns = [:entreprise_id] + belongs_to :dossier, optional: true has_one :champ, class_name: 'Champs::SiretChamp' From a26537c77d077bdbb859e2727c1d0981aadab620 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 26 Jan 2021 14:32:34 +0100 Subject: [PATCH 2/2] Make some api entreprise fields optional --- app/graphql/schema.graphql | 8 ++++---- app/graphql/types/personne_morale_type.rb | 8 ++++---- app/models/entreprise.rb | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/graphql/schema.graphql b/app/graphql/schema.graphql index 357922337..8e1db6da2 100644 --- a/app/graphql/schema.graphql +++ b/app/graphql/schema.graphql @@ -803,13 +803,13 @@ type Entreprise { effectif pour un mois donné """ effectifMensuel: Effectif - formeJuridique: String! - formeJuridiqueCode: String! + formeJuridique: String + formeJuridiqueCode: String inlineAdresse: String! - nom: String! + nom: String nomCommercial: String! numeroTvaIntracommunautaire: String! - prenom: String! + prenom: String raisonSociale: String! siren: String! siretSiegeSocial: String! diff --git a/app/graphql/types/personne_morale_type.rb b/app/graphql/types/personne_morale_type.rb index 2a74a0cea..c84f0925d 100644 --- a/app/graphql/types/personne_morale_type.rb +++ b/app/graphql/types/personne_morale_type.rb @@ -9,8 +9,8 @@ module Types field :siren, String, null: false field :capital_social, GraphQL::Types::BigInt, null: false, description: "capital social de l’entreprise. -1 si inconnu." field :numero_tva_intracommunautaire, String, null: false - field :forme_juridique, String, null: false - field :forme_juridique_code, String, null: false + field :forme_juridique, String, null: true + field :forme_juridique_code, String, null: true field :nom_commercial, String, null: false field :raison_sociale, String, null: false field :siret_siege_social, String, null: false @@ -18,8 +18,8 @@ module Types field :effectif_mensuel, EffectifType, null: true, description: "effectif pour un mois donné" field :effectif_annuel, EffectifType, null: true, description: "effectif moyen d’une année" field :date_creation, GraphQL::Types::ISO8601Date, null: false - field :nom, String, null: false - field :prenom, String, null: false + field :nom, String, null: true + field :prenom, String, null: true field :inline_adresse, String, null: false field :attestation_sociale_attachment, Types::File, null: true field :attestation_fiscale_attachment, Types::File, null: true diff --git a/app/models/entreprise.rb b/app/models/entreprise.rb index 3b471cbaf..366a695f5 100644 --- a/app/models/entreprise.rb +++ b/app/models/entreprise.rb @@ -7,8 +7,8 @@ class Entreprise < Hashie::Dash property :siren property :capital_social property :numero_tva_intracommunautaire - property :forme_juridique - property :forme_juridique_code + property :forme_juridique, default: nil + property :forme_juridique_code, default: nil property :nom_commercial property :raison_sociale property :siret_siege_social @@ -19,8 +19,8 @@ class Entreprise < Hashie::Dash property :effectif_annuel property :effectif_annuel_annee property :date_creation - property :nom - property :prenom + property :nom, default: nil + property :prenom, default: nil property :inline_adresse end