From bf67b3f7ad2f8be6cad68e38457088054d20edf6 Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Fri, 14 Apr 2017 17:48:13 +0200 Subject: [PATCH] Add dossier workflow dates to the API --- app/serializers/dossier_serializer.rb | 5 ++++- doc/apipie_examples.json | 3 +++ spec/controllers/api/v1/dossiers_controller_spec.rb | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/serializers/dossier_serializer.rb b/app/serializers/dossier_serializer.rb index 41336c6cf..207225ad5 100644 --- a/app/serializers/dossier_serializer.rb +++ b/app/serializers/dossier_serializer.rb @@ -5,7 +5,10 @@ class DossierSerializer < ActiveModel::Serializer :archived, :mandataire_social, :state, - :simplified_state + :simplified_state, + :initiated_at, + :received_at, + :processed_at has_one :entreprise has_one :etablissement diff --git a/doc/apipie_examples.json b/doc/apipie_examples.json index 285fa49e3..839b58095 100644 --- a/doc/apipie_examples.json +++ b/doc/apipie_examples.json @@ -47,6 +47,9 @@ "mandataire_social": false, "state": "updated", "simplified_state": "En construction", + "initiated_at": "2017-04-11T12:00:12.000Z", + "received_at": null, + "processed_at": null, "entreprise": { "siren": "440117620", "capital_social": 537100000, diff --git a/spec/controllers/api/v1/dossiers_controller_spec.rb b/spec/controllers/api/v1/dossiers_controller_spec.rb index 67a4688f5..e1d2dcc6d 100644 --- a/spec/controllers/api/v1/dossiers_controller_spec.rb +++ b/spec/controllers/api/v1/dossiers_controller_spec.rb @@ -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] } + 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] } subject { body[:dossier] } it 'return REST code 200', :show_in_doc do