Merge pull request #5118 from betagouv/5116-expose-attestations
API expose désormais attestationSocialeAttachment et attestationFiscaleAttachment
This commit is contained in:
commit
083a33bd23
4 changed files with 23 additions and 0 deletions
|
@ -692,6 +692,8 @@ type Effectif {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Entreprise {
|
type Entreprise {
|
||||||
|
attestationFiscaleAttachment: File
|
||||||
|
attestationSocialeAttachment: File
|
||||||
capitalSocial: BigInt!
|
capitalSocial: BigInt!
|
||||||
codeEffectifEntreprise: String!
|
codeEffectifEntreprise: String!
|
||||||
dateCreation: ISO8601Date!
|
dateCreation: ISO8601Date!
|
||||||
|
|
|
@ -21,6 +21,16 @@ module Types
|
||||||
field :nom, String, null: false
|
field :nom, String, null: false
|
||||||
field :prenom, String, null: false
|
field :prenom, String, null: false
|
||||||
field :inline_adresse, String, null: false
|
field :inline_adresse, String, null: false
|
||||||
|
field :attestation_sociale_attachment, Types::File, null: true
|
||||||
|
field :attestation_fiscale_attachment, Types::File, null: true
|
||||||
|
|
||||||
|
def attestation_sociale_attachment
|
||||||
|
load_attachment_for(:entreprise_attestation_sociale_attachment)
|
||||||
|
end
|
||||||
|
|
||||||
|
def attestation_fiscale_attachment
|
||||||
|
load_attachment_for(:entreprise_attestation_fiscale_attachment)
|
||||||
|
end
|
||||||
|
|
||||||
def effectif_mensuel
|
def effectif_mensuel
|
||||||
if object.effectif_mensuel.present?
|
if object.effectif_mensuel.present?
|
||||||
|
@ -39,6 +49,15 @@ module Types
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def load_attachment_for(key)
|
||||||
|
Loaders::Association.for(
|
||||||
|
Etablissement,
|
||||||
|
key => :blob
|
||||||
|
).load(object.etablissement)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class AssociationType < Types::BaseObject
|
class AssociationType < Types::BaseObject
|
||||||
|
|
|
@ -3,6 +3,7 @@ class Entreprise < Hashie::Dash
|
||||||
self[attribute]
|
self[attribute]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
property :etablissement
|
||||||
property :siren
|
property :siren
|
||||||
property :capital_social
|
property :capital_social
|
||||||
property :numero_tva_intracommunautaire
|
property :numero_tva_intracommunautaire
|
||||||
|
|
|
@ -96,6 +96,7 @@ class Etablissement < ApplicationRecord
|
||||||
|
|
||||||
def entreprise
|
def entreprise
|
||||||
Entreprise.new(
|
Entreprise.new(
|
||||||
|
etablissement: self,
|
||||||
siren: entreprise_siren,
|
siren: entreprise_siren,
|
||||||
capital_social: entreprise_capital_social,
|
capital_social: entreprise_capital_social,
|
||||||
numero_tva_intracommunautaire: entreprise_numero_tva_intracommunautaire,
|
numero_tva_intracommunautaire: entreprise_numero_tva_intracommunautaire,
|
||||||
|
|
Loading…
Add table
Reference in a new issue