fix(api-v1): piece justificative serialization

This commit is contained in:
Colin Darie 2022-11-08 10:29:49 +01:00
parent 1f8d28c678
commit 3affd1660f

View file

@ -46,13 +46,15 @@ class PiecesJustificativesService
def self.serialize_champs_as_pjs(dossier) def self.serialize_champs_as_pjs(dossier)
dossier.champs_public.filter { |champ| champ.type_de_champ.old_pj }.map do |champ| dossier.champs_public.filter { |champ| champ.type_de_champ.old_pj }.map do |champ|
{ champ.for_api&.map do |content_url|
created_at: champ.created_at&.in_time_zone('UTC'), {
type_de_piece_justificative_id: champ.type_de_champ.old_pj[:stable_id], created_at: champ.created_at&.in_time_zone('UTC'),
content_url: champ.for_api, type_de_piece_justificative_id: champ.type_de_champ.old_pj[:stable_id],
user: champ.dossier.user content_url:,
} user: champ.dossier.user
end }
end
end.flatten
end end
def self.clone_attachments(original, kopy) def self.clone_attachments(original, kopy)