dscf-marketplace 0.13.11 → 0.13.12

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: 7dd1a186494d212b2e44fe094c3f31440f21764924868264316894e1152a7160
4
- data.tar.gz: 03f4880b762fcf7ecebd26cc7368b07ee215b8445df4b61173b17a59dabca686
3
+ metadata.gz: f9046b11415bd21ad907cc8c1c91cbc686c20a1ee190ed05d37e237462bcade4
4
+ data.tar.gz: 4e40a8e77aa18c7c650b8e7eb134834548a6e4d8de414c29f3cbf07336e08f98
5
5
  SHA512:
6
- metadata.gz: 25a80f9a800788bb55dcfd6d44bf991b6bcf8ae25a11d4a5aa539b8db3154d0351107a990ca8844096d59a7bb4405979e52e4d8c8a0e1efc132dedbebfe2a412
7
- data.tar.gz: 8efd86df8d48b449a15921f8acddd728b957e677840180111614d8680fb0c08c723b8533a110d7da13b5e126121eba73a9de5f18ff93ec49fd91864ef92221c5
6
+ metadata.gz: a42817c825294cdf7446c52f1e091b4e808973aba691f07b7d0d8f6e7ebfd51ffc56e2ae3ef58f2ebef15fd3c8e32028e840c878371e50cb21db6d7f8088b693
7
+ data.tar.gz: f73775c91a7bdcf29be33684066f7b3c17a9d21035cd40f8365d7cf18cb400cefe67846abc84fe232a82828e6bbcb289b6db8d8e2e90890befdd9dc23a7bae32
@@ -8,7 +8,7 @@ module Dscf
8
8
  def model_params
9
9
  params.require(:sub_supplier).permit(
10
10
  :business_name, :contact_person_name, :contact_person_phone,
11
- :city, :sub_city, :woreda, :supplier_id, :business_license
11
+ :city, :sub_city, :woreda, :business_license
12
12
  )
13
13
  end
14
14
  end
@@ -1,7 +1,10 @@
1
1
  module Dscf::Marketplace
2
2
  class SubSupplier < ApplicationRecord
3
- # Associations
4
- belongs_to :supplier, class_name: "Dscf::Marketplace::Supplier"
3
+ include Dscf::Marketplace::AttachmentUrls
4
+
5
+ # Sub-suppliers are independent, offline entities the aggregator manages
6
+ # directly — never linked to a Supplier. (Requirements doc: sub-suppliers
7
+ # "don't act directly on the system"; see AggregatorListing#confirming_business.)
5
8
 
6
9
  # Active Storage
7
10
  has_one_attached :business_license
@@ -16,17 +19,18 @@ module Dscf::Marketplace
16
19
  validates :city, presence: true
17
20
  validates :code, presence: true, uniqueness: true
18
21
 
19
- # Scopes
20
- scope :by_supplier, ->(id) { where(supplier_id: id) }
21
-
22
22
  # Ransack
23
23
  def self.ransackable_attributes(_auth_object = nil)
24
- %w[id supplier_id business_name contact_person_name contact_person_phone
24
+ %w[id business_name contact_person_name contact_person_phone
25
25
  city sub_city woreda code created_at updated_at]
26
26
  end
27
27
 
28
28
  def self.ransackable_associations(_auth_object = nil)
29
- %w[supplier business_license_attachment business_license_blob]
29
+ %w[business_license_attachment business_license_blob]
30
+ end
31
+
32
+ def business_license_url
33
+ attachment_url_for(business_license)
30
34
  end
31
35
 
32
36
  private
@@ -2,13 +2,11 @@ module Dscf
2
2
  module Marketplace
3
3
  class SubSupplierSerializer < ActiveModel::Serializer
4
4
  attributes :id, :code, :business_name, :contact_person_name, :contact_person_phone,
5
- :city, :sub_city, :woreda, :supplier_id, :business_license_url,
5
+ :city, :sub_city, :woreda, :business_license_url,
6
6
  :created_at, :updated_at
7
7
 
8
8
  def business_license_url
9
- return nil unless object.business_license.attached?
10
-
11
- Rails.application.routes.url_helpers.rails_storage_proxy_url(object.business_license, only_path: true)
9
+ object.business_license_url
12
10
  end
13
11
  end
14
12
  end
@@ -0,0 +1,10 @@
1
+ class RemoveSupplierFromDscfMarketplaceSubSuppliers < ActiveRecord::Migration[8.0]
2
+ def change
3
+ # Sub-suppliers are never linked to a supplier — that relationship was
4
+ # modeled by mistake; sub-suppliers are independent, offline entities the
5
+ # aggregator manages directly (see AggregatorListing#confirming_business).
6
+ remove_reference :dscf_marketplace_sub_suppliers, :supplier,
7
+ foreign_key: {to_table: :dscf_marketplace_suppliers},
8
+ index: {name: "supplier_on_dm_sub_suppliers_indx"}
9
+ end
10
+ end
@@ -1,5 +1,5 @@
1
1
  module Dscf
2
2
  module Marketplace
3
- VERSION = "0.13.11".freeze
3
+ VERSION = "0.13.12".freeze
4
4
  end
5
5
  end
@@ -6,6 +6,5 @@ FactoryBot.define do
6
6
  city { Faker::Address.city }
7
7
  sub_city { Faker::Address.community }
8
8
  woreda { Faker::Address.street_name }
9
- association :supplier, factory: :dscf_marketplace_supplier
10
9
  end
11
10
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dscf-marketplace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.11
4
+ version: 0.13.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Asrat
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-07-08 00:00:00.000000000 Z
10
+ date: 2026-07-09 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails
@@ -600,6 +600,7 @@ files:
600
600
  - db/migrate/20260704000002_create_dscf_marketplace_otp_verifications.rb
601
601
  - db/migrate/20260708000001_make_retailer_tin_number_optional.rb
602
602
  - db/migrate/20260708000002_make_product_gross_weight_optional.rb
603
+ - db/migrate/20260709000001_remove_supplier_from_dscf_marketplace_sub_suppliers.rb
603
604
  - db/seeds.rb
604
605
  - lib/dscf/marketplace.rb
605
606
  - lib/dscf/marketplace/engine.rb