Sha256: e3fa3b94c8bd0fc3fc8667643b04b5f4b9465cdd6755ca31d538a891494ea50e

Contents?: true

Size: 756 Bytes

Versions: 27

Compression:

Stored size: 756 Bytes

Contents

require_relative "success_serializer"

module Foobara
  module CommandConnectors
    module Serializers
      class RecordStoreSerializer < SuccessSerializer
        def atomic_serializer
          @atomic_serializer ||= AtomicSerializer.new(declaration_data)
        end

        def serialize(_object)
          store = {}

          declaration_data.command.transactions.each do |tx|
            tx.each_table do |table|
              key = table.entity_class.full_entity_name

              map = store[key] ||= {}

              table.tracked_records.each do |record|
                map[record.primary_key] = atomic_serializer.transform(record)
              end
            end
          end

          store
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
foobara-0.0.7 projects/command_connectors/src/serializers/record_store_serializer.rb
foobara-0.0.6 projects/command_connectors/src/serializers/record_store_serializer.rb
foobara-0.0.5 projects/command_connectors/src/serializers/record_store_serializer.rb
foobara-0.0.4 projects/command_connectors/src/serializers/record_store_serializer.rb
foobara-0.0.3 projects/command_connectors/src/serializers/record_store_serializer.rb
foobara-0.0.2 projects/command_connectors/src/serializers/record_store_serializer.rb
foobara-0.0.1 projects/command_connectors/src/serializers/record_store_serializer.rb