add effectif mensuel to graphql api
This commit is contained in:
parent
1165f8483d
commit
149b98007f
7 changed files with 46 additions and 1 deletions
|
@ -686,10 +686,24 @@ enum DossierState {
|
||||||
sans_suite
|
sans_suite
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Effectif {
|
||||||
|
"""
|
||||||
|
Année de l'effectif mensuel
|
||||||
|
"""
|
||||||
|
annee: String!
|
||||||
|
|
||||||
|
"""
|
||||||
|
Mois de l'effectif mensuel
|
||||||
|
"""
|
||||||
|
mois: String!
|
||||||
|
nb: Float!
|
||||||
|
}
|
||||||
|
|
||||||
type Entreprise {
|
type Entreprise {
|
||||||
capitalSocial: BigInt!
|
capitalSocial: BigInt!
|
||||||
codeEffectifEntreprise: String!
|
codeEffectifEntreprise: String!
|
||||||
dateCreation: ISO8601Date!
|
dateCreation: ISO8601Date!
|
||||||
|
effectifs: [Effectif!]!
|
||||||
formeJuridique: String!
|
formeJuridique: String!
|
||||||
formeJuridiqueCode: String!
|
formeJuridiqueCode: String!
|
||||||
inlineAdresse: String!
|
inlineAdresse: String!
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
module Types
|
module Types
|
||||||
class PersonneMoraleType < Types::BaseObject
|
class PersonneMoraleType < Types::BaseObject
|
||||||
class EntrepriseType < Types::BaseObject
|
class EntrepriseType < Types::BaseObject
|
||||||
|
class EffectifType < Types::BaseObject
|
||||||
|
field :mois, String, null: false, description: "Mois de l'effectif mensuel"
|
||||||
|
field :annee, String, null: false, description: "Année de l'effectif mensuel"
|
||||||
|
field :nb, Float, null: false
|
||||||
|
end
|
||||||
|
|
||||||
field :siren, String, null: false
|
field :siren, String, null: false
|
||||||
field :capital_social, GraphQL::Types::BigInt, null: false
|
field :capital_social, GraphQL::Types::BigInt, null: false
|
||||||
field :numero_tva_intracommunautaire, String, null: false
|
field :numero_tva_intracommunautaire, String, null: false
|
||||||
|
@ -10,10 +16,23 @@ module Types
|
||||||
field :raison_sociale, String, null: false
|
field :raison_sociale, String, null: false
|
||||||
field :siret_siege_social, String, null: false
|
field :siret_siege_social, String, null: false
|
||||||
field :code_effectif_entreprise, String, null: false
|
field :code_effectif_entreprise, String, null: false
|
||||||
|
field :effectifs, [EffectifType], null: false
|
||||||
field :date_creation, GraphQL::Types::ISO8601Date, null: false
|
field :date_creation, GraphQL::Types::ISO8601Date, null: false
|
||||||
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
|
||||||
|
|
||||||
|
def effectifs
|
||||||
|
if object.effectif_mensuel.present?
|
||||||
|
[
|
||||||
|
{
|
||||||
|
mois: object.effectif_mois,
|
||||||
|
annee: object.effectif_annee,
|
||||||
|
nb: object.effectif_mensuel
|
||||||
|
}
|
||||||
|
]
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class AssociationType < Types::BaseObject
|
class AssociationType < Types::BaseObject
|
||||||
|
|
|
@ -12,6 +12,9 @@ class Entreprise < Hashie::Dash
|
||||||
property :raison_sociale
|
property :raison_sociale
|
||||||
property :siret_siege_social
|
property :siret_siege_social
|
||||||
property :code_effectif_entreprise
|
property :code_effectif_entreprise
|
||||||
|
property :effectif_mois
|
||||||
|
property :effectif_annee
|
||||||
|
property :effectif_mensuel
|
||||||
property :date_creation
|
property :date_creation
|
||||||
property :nom
|
property :nom
|
||||||
property :prenom
|
property :prenom
|
||||||
|
|
|
@ -102,6 +102,9 @@ class Etablissement < ApplicationRecord
|
||||||
raison_sociale: entreprise_raison_sociale,
|
raison_sociale: entreprise_raison_sociale,
|
||||||
siret_siege_social: entreprise_siret_siege_social,
|
siret_siege_social: entreprise_siret_siege_social,
|
||||||
code_effectif_entreprise: entreprise_code_effectif_entreprise,
|
code_effectif_entreprise: entreprise_code_effectif_entreprise,
|
||||||
|
effectif_mensuel: entreprise_effectif_mensuel,
|
||||||
|
effectif_mois: entreprise_effectif_mois,
|
||||||
|
effectif_annee: entreprise_effectif_annee,
|
||||||
date_creation: entreprise_date_creation,
|
date_creation: entreprise_date_creation,
|
||||||
nom: entreprise_nom,
|
nom: entreprise_nom,
|
||||||
prenom: entreprise_prenom,
|
prenom: entreprise_prenom,
|
||||||
|
|
|
@ -8,6 +8,9 @@ class EntrepriseSerializer < ActiveModel::Serializer
|
||||||
:raison_sociale,
|
:raison_sociale,
|
||||||
:siret_siege_social,
|
:siret_siege_social,
|
||||||
:code_effectif_entreprise,
|
:code_effectif_entreprise,
|
||||||
|
:effectif_mois,
|
||||||
|
:effectif_annee,
|
||||||
|
:effectif_mensuel,
|
||||||
:date_creation,
|
:date_creation,
|
||||||
:nom,
|
:nom,
|
||||||
:prenom
|
:prenom
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
%th.libelle
|
%th.libelle
|
||||||
Effectif mensuel
|
Effectif mensuel
|
||||||
= try_format_mois_effectif(etablissement)
|
= try_format_mois_effectif(etablissement)
|
||||||
%td= etablissement.effectif_mensuel
|
%td= etablissement.entreprise_effectif_mensuel
|
||||||
%tr
|
%tr
|
||||||
%th.libelle Effectif de l'organisation :
|
%th.libelle Effectif de l'organisation :
|
||||||
%td= effectif(etablissement)
|
%td= effectif(etablissement)
|
||||||
|
|
|
@ -197,6 +197,9 @@ describe API::V1::DossiersController do
|
||||||
:raison_sociale,
|
:raison_sociale,
|
||||||
:siret_siege_social,
|
:siret_siege_social,
|
||||||
:code_effectif_entreprise,
|
:code_effectif_entreprise,
|
||||||
|
:effectif_mois,
|
||||||
|
:effectif_annee,
|
||||||
|
:effectif_mensuel,
|
||||||
:date_creation,
|
:date_creation,
|
||||||
:nom,
|
:nom,
|
||||||
:prenom
|
:prenom
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue