Add invites to API
This commit is contained in:
parent
40d897f538
commit
757af12d42
4 changed files with 11 additions and 2 deletions
|
@ -22,6 +22,7 @@ class Dossier < ActiveRecord::Base
|
|||
has_many :commentaires, dependent: :destroy
|
||||
has_many :invites, dependent: :destroy
|
||||
has_many :invites_user, class_name: 'InviteUser', dependent: :destroy
|
||||
has_many :invites_gestionnaires, class_name: 'InviteGestionnaire', dependent: :destroy
|
||||
has_many :follows
|
||||
has_many :notifications, dependent: :destroy
|
||||
|
||||
|
|
|
@ -9,7 +9,8 @@ class DossierSerializer < ActiveModel::Serializer
|
|||
:initiated_at,
|
||||
:received_at,
|
||||
:processed_at,
|
||||
:accompagnateurs
|
||||
:accompagnateurs,
|
||||
:invites
|
||||
|
||||
has_one :entreprise
|
||||
has_one :etablissement
|
||||
|
@ -27,4 +28,8 @@ class DossierSerializer < ActiveModel::Serializer
|
|||
def accompagnateurs
|
||||
object.followers_gestionnaires.pluck(:email)
|
||||
end
|
||||
|
||||
def invites
|
||||
object.invites_gestionnaires.pluck(:email)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -53,6 +53,9 @@
|
|||
"accompagnateurs": [
|
||||
"gestionnaire@apientreprise.fr"
|
||||
],
|
||||
"invites": [
|
||||
"nom@domaine.fr"
|
||||
],
|
||||
"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) } }
|
||||
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, :accompagnateurs] }
|
||||
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, :accompagnateurs, :invites] }
|
||||
subject { body[:dossier] }
|
||||
|
||||
it 'return REST code 200', :show_in_doc do
|
||||
|
|
Loading…
Reference in a new issue