Sha256: d2a72f2dc6e3294c8b60599de424e2babf6e83ead1cf1524d88ba05f61efee28

Contents?: true

Size: 915 Bytes

Versions: 2

Compression:

Stored size: 915 Bytes

Contents

module Workarea
  module Orderbot
    class ProductImportData
      include ApplicationDocument

      field :product_id, type: String
      field :product_data, type: Hash
      field :parent_product, type: Boolean, default: false
      field :has_children, type: Boolean, default: false
      field :parent_product_id, type: String
      field :error_message, type: String

      index({ created_at: 1 }, { expire_after_seconds: 6.months.seconds.to_i })
      index({ parent_product_id: 1 })
      index({ parent_product: 1 })
      index({ product_id: 1 })

      index(
        {
          parent_product: 1,
          has_children: 1
        },
      {
        name: 'child_prduct_import_index'
      }
    )

      scope :parent_products, -> { where(parent_product: true) }
      scope :child_products, -> { any_of({ parent_product: false }, { parent_product: true, has_children: false }) }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-orderbot-1.0.1 app/models/workarea/orderbot/product_import_data.rb
workarea-orderbot-1.0.0 app/models/workarea/orderbot/product_import_data.rb