Sha256: 3263f959abb0c41d1adf91c8d5d93346353b5d2578aa31fe371dac13a2c652f5

Contents?: true

Size: 1.25 KB

Versions: 6

Compression:

Stored size: 1.25 KB

Contents

module ReactiveRecord
  module Operations
  # fetch queued up records from the server
    class Fetch < Hyperloop::ServerOp
      param :acting_user, nils: true
      param models: []
      param associations: []
      param :pending_fetches
      step do
        ReactiveRecord::ServerDataCache[
          params.models.map(&:with_indifferent_access),
          params.associations.map(&:with_indifferent_access),
          params.pending_fetches,
          params.acting_user
        ]
      end
    end

    class Save < Hyperloop::ServerOp
      param :acting_user, nils: true
      param models: []
      param associations: []
      param :validate, type: :boolean

      step do
        ReactiveRecord::Base.save_records(
          params.models.map(&:with_indifferent_access),
          params.associations.map(&:with_indifferent_access),
          params.acting_user,
          params.validate,
          true
        )
      end
    end

    class Destroy < Hyperloop::ServerOp
      param :acting_user, nils: true
      param :model
      param :id
      param :vector
      step do
        ReactiveRecord::Base.destroy_record(
          params.model,
          params.id,
          params.vector,
          params.acting_user
        )
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hyper-mesh-1.0.0.lap25 lib/reactive_record/active_record/reactive_record/operations.rb
hyper-mesh-1.0.0.lap24 lib/reactive_record/active_record/reactive_record/operations.rb
hyper-mesh-1.0.0.lap23 lib/reactive_record/active_record/reactive_record/operations.rb
hyper-mesh-1.0.0.lap22 lib/reactive_record/active_record/reactive_record/operations.rb
hyper-mesh-0.6.0 lib/reactive_record/active_record/reactive_record/operations.rb
hyper-mesh-0.5.4 lib/reactive_record/active_record/reactive_record/operations.rb