2016-01-20 15:48:46 +01:00
|
|
|
class DossierSerializer < ActiveModel::Serializer
|
|
|
|
attributes :id,
|
2017-06-12 13:49:51 +02:00
|
|
|
:created_at,
|
|
|
|
:updated_at,
|
|
|
|
:archived,
|
|
|
|
:mandataire_social,
|
|
|
|
:state,
|
|
|
|
:simplified_state,
|
|
|
|
:initiated_at,
|
|
|
|
:received_at,
|
|
|
|
:processed_at,
|
2017-06-15 17:36:30 +02:00
|
|
|
:motivation,
|
2017-06-12 13:49:51 +02:00
|
|
|
:accompagnateurs,
|
|
|
|
:invites
|
2016-01-25 16:08:10 +01:00
|
|
|
|
|
|
|
has_one :entreprise
|
|
|
|
has_one :etablissement
|
2016-03-16 15:34:35 +01:00
|
|
|
has_many :cerfa
|
2016-03-14 10:34:46 +01:00
|
|
|
has_many :commentaires
|
2016-02-26 12:17:41 +01:00
|
|
|
has_many :champs
|
2016-08-08 12:52:30 +02:00
|
|
|
has_many :champs_private
|
2016-03-17 17:33:38 +01:00
|
|
|
has_many :pieces_justificatives
|
2016-03-17 14:50:10 +01:00
|
|
|
has_many :types_de_piece_justificative
|
2017-04-14 17:38:08 +02:00
|
|
|
|
|
|
|
def simplified_state
|
|
|
|
object.decorate.display_state
|
|
|
|
end
|
2017-04-14 18:10:39 +02:00
|
|
|
|
|
|
|
def accompagnateurs
|
|
|
|
object.followers_gestionnaires.pluck(:email)
|
|
|
|
end
|
2017-04-14 18:20:14 +02:00
|
|
|
|
|
|
|
def invites
|
|
|
|
object.invites_gestionnaires.pluck(:email)
|
|
|
|
end
|
2016-11-09 15:36:18 +01:00
|
|
|
end
|