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)
dossier.champs_public.filter { |champ| champ.type_de_champ.old_pj }.map do |champ|
{
created_at: champ.created_at&.in_time_zone('UTC'),
type_de_piece_justificative_id: champ.type_de_champ.old_pj[:stable_id],
content_url: champ.for_api,
user: champ.dossier.user
}
end
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],
content_url:,
user: champ.dossier.user
}
end
end.flatten
end
def self.clone_attachments(original, kopy)