commit
1680f19a36
7 changed files with 44 additions and 8 deletions
|
@ -4,6 +4,10 @@ class CommentaireSerializer < ActiveModel::Serializer
|
|||
:created_at,
|
||||
:attachment
|
||||
|
||||
def created_at
|
||||
object.created_at&.in_time_zone('UTC')
|
||||
end
|
||||
|
||||
def attachment
|
||||
object.file_url
|
||||
end
|
||||
|
|
|
@ -50,17 +50,29 @@ class DossierSerializer < ActiveModel::Serializer
|
|||
end
|
||||
|
||||
def initiated_at
|
||||
object.en_construction_at
|
||||
object.en_construction_at&.in_time_zone('UTC')
|
||||
end
|
||||
|
||||
def received_at
|
||||
object.en_instruction_at
|
||||
object.en_instruction_at&.in_time_zone('UTC')
|
||||
end
|
||||
|
||||
def instructeurs
|
||||
object.followers_gestionnaires.pluck(:email)
|
||||
end
|
||||
|
||||
def created_at
|
||||
object.created_at&.in_time_zone('UTC')
|
||||
end
|
||||
|
||||
def updated_at
|
||||
object.updated_at&.in_time_zone('UTC')
|
||||
end
|
||||
|
||||
def processed_at
|
||||
object.processed_at&.in_time_zone('UTC')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def user_geometry(dossier)
|
||||
|
|
|
@ -4,8 +4,12 @@ class DossiersSerializer < ActiveModel::Serializer
|
|||
:initiated_at,
|
||||
:state
|
||||
|
||||
def updated_at
|
||||
object.updated_at&.in_time_zone('UTC')
|
||||
end
|
||||
|
||||
def initiated_at
|
||||
object.en_construction_at
|
||||
object.en_construction_at&.in_time_zone('UTC')
|
||||
end
|
||||
|
||||
def state
|
||||
|
|
|
@ -4,4 +4,8 @@ class PieceJustificativeSerializer < ActiveModel::Serializer
|
|||
:content_url
|
||||
|
||||
has_one :user
|
||||
|
||||
def created_at
|
||||
object.created_at&.in_time_zone('UTC')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,6 +18,10 @@ class ProcedureSerializer < ActiveModel::Serializer
|
|||
has_many :types_de_champ_private, serializer: TypeDeChampSerializer
|
||||
has_many :types_de_piece_justificative, serializer: TypeDePieceJustificativeSerializer
|
||||
|
||||
def archived_at
|
||||
object.archived_at&.in_time_zone('UTC')
|
||||
end
|
||||
|
||||
def link
|
||||
if object.path.present?
|
||||
if object.brouillon_avec_lien?
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
namespace :after_party do
|
||||
desc 'Deployment task: remove_path_from_archived_procedures'
|
||||
task remove_path_from_archived_procedures: :environment do
|
||||
Procedure.archivees.where.not(path: nil).update_all(path: nil)
|
||||
|
||||
AfterParty::TaskRecord.create version: '20181031104615'
|
||||
end
|
||||
end
|
|
@ -75,8 +75,8 @@ describe API::V1::DossiersController do
|
|||
describe 'dossier' do
|
||||
subject { super().first }
|
||||
it { expect(subject[:id]).to eq(dossier.id) }
|
||||
it { expect(subject[:updated_at]).to eq("2008-09-01T10:05:00.000+02:00") }
|
||||
it { expect(subject[:initiated_at]).to eq("2008-09-01T10:06:00.000+02:00") }
|
||||
it { expect(subject[:updated_at]).to eq("2008-09-01T08:05:00.000Z") }
|
||||
it { expect(subject[:initiated_at]).to eq("2008-09-01T08:06:00.000Z") }
|
||||
it { expect(subject[:state]).to eq("initiated") }
|
||||
it { expect(subject.keys.size).to eq(4) }
|
||||
end
|
||||
|
@ -148,8 +148,8 @@ describe API::V1::DossiersController do
|
|||
|
||||
it { expect(subject[:id]).to eq(dossier.id) }
|
||||
it { expect(subject[:state]).to eq(dossier.state) }
|
||||
it { expect(subject[:created_at]).to eq('2008-09-01T10:05:00.000+02:00') }
|
||||
it { expect(subject[:updated_at]).to eq('2008-09-01T10:05:00.000+02:00') }
|
||||
it { expect(subject[:created_at]).to eq('2008-09-01T08:05:00.000Z') }
|
||||
it { expect(subject[:updated_at]).to eq('2008-09-01T08:05:00.000Z') }
|
||||
it { expect(subject[:archived]).to eq(dossier.archived) }
|
||||
|
||||
it { expect(subject.keys).to match_array(field_list) }
|
||||
|
@ -337,7 +337,7 @@ describe API::V1::DossiersController do
|
|||
it { expect(subject.size).to eq 2 }
|
||||
|
||||
it { expect(subject.first[:body]).to eq 'plop' }
|
||||
it { expect(subject.first[:created_at]).to eq '2016-03-14T14:00:00.000+01:00' }
|
||||
it { expect(subject.first[:created_at]).to eq '2016-03-14T13:00:00.000Z' }
|
||||
it { expect(subject.first[:email]).to eq 'plop@plip.com' }
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue