Sha256: 67dda5450daab1e10ab94ccc3bf6561836d879c3c430b9b5ac85f3bbd1e6e9b2
Contents?: true
Size: 1.09 KB
Versions: 37
Compression:
Stored size: 1.09 KB
Contents
# frozen_string_literal: true module Decidim # This class serializes a Message so can be exported to CSV module DataPortabilitySerializers class DataPortabilityConversationSerializer < Decidim::Exporters::Serializer include Decidim::ResourceHelper # Public: Initializes the serializer with a conversation. def initialize(conversation) @conversation = conversation end # Public: Exports a hash with the serialized data for this conversation. def serialize { id: conversation.id, messages: messages, created_at: conversation.created_at, updated_at: conversation.updated_at } end private attr_reader :conversation def messages conversation.messages.map do |message| { message_id: message.id, sender_id: message.sender.id, sender_name: message.sender.name, body: message.body, created_at: message.created_at, updated_at: message.updated_at } end end end end end
Version data entries
37 entries across 37 versions & 1 rubygems