[fix #1000] export name and first name in api
This commit is contained in:
parent
c4498ece2b
commit
b02282c1d0
5 changed files with 19 additions and 1 deletions
|
@ -14,6 +14,7 @@ class DossierSerializer < ActiveModel::Serializer
|
|||
:accompagnateurs,
|
||||
:invites
|
||||
|
||||
has_one :individual
|
||||
has_one :entreprise
|
||||
has_one :etablissement
|
||||
has_many :cerfa
|
||||
|
|
3
app/serializers/individual_serializer.rb
Normal file
3
app/serializers/individual_serializer.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
class IndividualSerializer < ActiveModel::Serializer
|
||||
attributes :nom, :prenom
|
||||
end
|
|
@ -58,6 +58,10 @@
|
|||
"invites": [
|
||||
"nom@domaine.fr"
|
||||
],
|
||||
"individual": {
|
||||
"nom": "Monmari",
|
||||
"prenom": "René"
|
||||
},
|
||||
"entreprise": {
|
||||
"siren": "440117620",
|
||||
"capital_social": 537100000,
|
||||
|
|
|
@ -115,7 +115,7 @@ describe API::V1::DossiersController do
|
|||
let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, procedure: procedure, motivation: "Motivation") } }
|
||||
let(:dossier_id) { dossier.id }
|
||||
let(:body) { JSON.parse(retour.body, symbolize_names: true) }
|
||||
let(:field_list) { [:id, :created_at, :updated_at, :archived, :mandataire_social, :entreprise, :etablissement, :cerfa, :types_de_piece_justificative, :pieces_justificatives, :champs, :champs_private, :commentaires, :state, :simplified_state, :initiated_at, :processed_at, :received_at, :motivation, :email, :accompagnateurs, :invites] }
|
||||
let(:field_list) { [:id, :created_at, :updated_at, :archived, :mandataire_social, :individual, :entreprise, :etablissement, :cerfa, :types_de_piece_justificative, :pieces_justificatives, :champs, :champs_private, :commentaires, :state, :simplified_state, :initiated_at, :processed_at, :received_at, :motivation, :email, :accompagnateurs, :invites] }
|
||||
subject { body[:dossier] }
|
||||
|
||||
it 'return REST code 200', :show_in_doc do
|
||||
|
|
10
spec/serializers/individual_serializer_spec.rb
Normal file
10
spec/serializers/individual_serializer_spec.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
describe IndividualSerializer do
|
||||
describe '#attributes' do
|
||||
let(:individual){ Individual.create(nom: 'nom', prenom: 'prenom') }
|
||||
|
||||
subject { IndividualSerializer.new(individual).serializable_hash }
|
||||
|
||||
it { is_expected.to include(nom: 'nom') }
|
||||
it { is_expected.to include(prenom: 'prenom') }
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue