[Fix #395] Export user email in API

This commit is contained in:
Mathieu Magnin 2017-08-01 14:19:58 +02:00
parent 931e547afa
commit dd581082ca
2 changed files with 6 additions and 1 deletions

View file

@ -3,6 +3,7 @@ class DossierSerializer < ActiveModel::Serializer
:created_at,
:updated_at,
:archived,
:email,
:mandataire_social,
:state,
:simplified_state,
@ -22,6 +23,10 @@ class DossierSerializer < ActiveModel::Serializer
has_many :pieces_justificatives
has_many :types_de_piece_justificative
def email
object.user.try(:email)
end
def simplified_state
object.decorate.display_state
end

View file

@ -114,7 +114,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, :accompagnateurs, :invites] }
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] }
subject { body[:dossier] }
it 'return REST code 200', :show_in_doc do