service and serializer

This commit is contained in:
Kara Diaby 2024-02-13 07:10:22 +00:00
parent b69d8249c5
commit bf622eb3ed
2 changed files with 2 additions and 6 deletions

View file

@ -2,13 +2,9 @@ class CommentaireSerializer < ActiveModel::Serializer
attributes :email,
:body,
:created_at,
:attachment
:piece_jointe_attachments
def created_at
object.created_at&.in_time_zone('UTC')
end
def attachment
object.file_url
end
end

View file

@ -161,7 +161,7 @@ class PiecesJustificativesService
def pjs_for_commentaires(dossiers)
commentaire_id_dossier_id = Commentaire
.joins(:piece_jointe_attachment)
.joins(:piece_jointe_attachments)
.where(dossier: dossiers)
.pluck(:id, :dossier_id)
.to_h