dscf-marketplace 0.2.8 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a001bdda08a7e52eb5e5c02224aa62c3b33d43798b1a42d061b7703415c65c79
4
- data.tar.gz: 86fc45b4129e5fe98cd1fda0dfb6c231d179c65c112b2f2e7fd4f5dc1a2ca573
3
+ metadata.gz: f51a5b893502ce6049f446264e9b3c7bab06887f7a8364a70d8a80c247470cc9
4
+ data.tar.gz: 05306e10728b7fcf42b05e8a80387e7d7833a8c7e54f5abd8fa4295cf1c1d5bc
5
5
  SHA512:
6
- metadata.gz: 656471a3d0b550412576a4f196f48b94820ba5f2a697b0ccf76140bd62166175e45ee3b44b5a4dd238a62cdb2060a540c3238a01711e53ead888687a470f0306
7
- data.tar.gz: c71001e3910cbef5e731ec60547883d2a24aacffd4c3a2415f641920907093968b75fea082ef686a614beaba0380091aaf365c748c80c39d04cd3386744c261b
6
+ metadata.gz: 9438af1ce5588f183b3421199c0b9e656576d2cd89aa89d6a0e9b8e5c552dab0030df18f185e896b2ffcb53b79bf548e03bb1c348c8928b52b706840ede268cd
7
+ data.tar.gz: '0948cb5588ba6f5a5c7d1e572b992a6d96fde59d0944c7c505aa0e630c0018d35a21cd9613191e0434c24b880b0a3117f60fe782d61ee836797356a041b22749'
@@ -1,28 +1,24 @@
1
1
  module Dscf::Marketplace
2
2
  class SupplierProduct < ApplicationRecord
3
- # References
4
3
  belongs_to :business, class_name: "Dscf::Core::Business"
5
4
  belongs_to :product, class_name: "Dscf::Marketplace::Product"
6
5
 
7
- # Relationships
6
+ delegate :name, :description, :thumbnail_url, :images_urls, to: :product, allow_nil: true
7
+
8
8
  has_many :listings, class_name: "Dscf::Marketplace::Listing"
9
9
  has_many :order_items, class_name: "Dscf::Marketplace::OrderItem"
10
10
 
11
- # Status enum
12
11
  enum :status, {active: 0, inactive: 1, discontinued: 2}, default: :active
13
12
 
14
- # Validations
15
13
  validates :supplier_price, numericality: {greater_than: 0}, presence: true
16
14
  validates :available_quantity, numericality: {greater_than_or_equal_to: 0}
17
15
  validates :minimum_order_quantity, numericality: {greater_than: 0}, allow_nil: true
18
16
 
19
- # Scopes
20
17
  scope :active, -> { where(status: :active) }
21
18
  scope :in_stock, -> { where("available_quantity > 0") }
22
19
  scope :by_business, ->(business_id) { where(business_id: business_id) }
23
20
  scope :by_product, ->(product_id) { where(product_id: product_id) }
24
21
 
25
- # Ransack configuration for secure filtering
26
22
  def self.ransackable_attributes(_auth_object = nil)
27
23
  %w[id business_id product_id supplier_price available_quantity minimum_order_quantity status created_at updated_at]
28
24
  end
@@ -3,7 +3,8 @@ module Dscf
3
3
  class SupplierProductSerializer < ActiveModel::Serializer
4
4
  attributes :id, :business_id, :product_id, :supplier_price, :available_quantity,
5
5
  :minimum_order_quantity, :status, :created_at, :updated_at,
6
- :in_stock?, :price_per_unit, :display_name
6
+ :in_stock?, :price_per_unit, :display_name, :name, :description,
7
+ :thumbnail_url, :images_urls
7
8
 
8
9
  belongs_to :business
9
10
  belongs_to :product
@@ -89,7 +89,7 @@ en:
89
89
  update: "Failed to update supplier product"
90
90
  destroy: "Failed to delete supplier product"
91
91
 
92
- listing:
92
+ listings:
93
93
  success:
94
94
  index: "Listings retrieved successfully"
95
95
  show: "Listing details retrieved successfully"
@@ -1,5 +1,5 @@
1
1
  module Dscf
2
2
  module Marketplace
3
- VERSION = "0.2.8".freeze
3
+ VERSION = "0.2.9".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dscf-marketplace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Asrat