dscf-marketplace 0.9.7 → 0.9.8

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: 0707e9c3f1aee47d4403629222fd56a4a643e581c5e15e7e578db9b2457c93db
4
- data.tar.gz: 21bd1451f5ed9da67e7fd1e703cdb780b70ffdfc092841bbf0f9e04440c79716
3
+ metadata.gz: 96faa437c564d4a08d4df63b8e1143c8e69da546d8e576e03d30bd2c99443e50
4
+ data.tar.gz: 58eeb5fed2f4afea0a88dd25f55d2bfc791a7d7f488a7be46357fcc4b79597fb
5
5
  SHA512:
6
- metadata.gz: 73d08aab0d6e61e2bb3c3e07051c8edab5a6b36021ab25461cea3e7bf1fd2bf35e4130f3376f8ec56c54804c8ed4fb8443e5cc153b391fef647a1f0ff8202d3f
7
- data.tar.gz: b52aecc0d699d73c06a800c2a20badcb4c7f0e8cacfbd2cb43e1cbea0a5c2b1b8f96264a763ea4a403b5a7379b4452e5fcec7aa29aaa2bc31b4532586fe0f29c
6
+ metadata.gz: cd51195fca94e7f6018aca92c64620f1f686a5b1584858add1afb1ceb0ee8a34b09e90fd27e9681dadbaef3a514741109c5a293aee3aa57c905f11df962cda4f
7
+ data.tar.gz: c9bc4eefa1acdd394eb3d23ae3a57f60126ccdb5dd698e64050c4ca8f48d2364a99c06266aff03b9d84b90a9d45ea2881e847d98a2b58a51335ee2751f245230
@@ -85,7 +85,7 @@ module Dscf
85
85
  authorize @obj, :show?
86
86
  invoice = @obj.order_invoice
87
87
  if invoice&.pdf_file&.attached?
88
- redirect_to rails_blob_url(invoice.pdf_file, disposition: "attachment")
88
+ redirect_to rails_storage_proxy_url(invoice.pdf_file, disposition: "attachment")
89
89
  else
90
90
  render_error("orders.errors.no_invoice")
91
91
  end
@@ -46,13 +46,13 @@ module Dscf::Marketplace
46
46
  def photo_url
47
47
  return nil unless photo.attached?
48
48
 
49
- Rails.application.routes.url_helpers.rails_blob_url(photo, only_path: true)
49
+ Rails.application.routes.url_helpers.rails_storage_proxy_url(photo, only_path: true)
50
50
  end
51
51
 
52
52
  def national_id_url
53
53
  return nil unless national_id.attached?
54
54
 
55
- Rails.application.routes.url_helpers.rails_blob_url(national_id, only_path: true)
55
+ Rails.application.routes.url_helpers.rails_storage_proxy_url(national_id, only_path: true)
56
56
  end
57
57
 
58
58
  private
@@ -8,6 +8,8 @@ module Dscf::Marketplace
8
8
  belongs_to :pickup_address, class_name: "Dscf::Core::Address"
9
9
  belongs_to :dropoff_address, class_name: "Dscf::Core::Address"
10
10
 
11
+ delegate :thumbnail_url, :images_urls, to: :order_item, allow_nil: true
12
+
11
13
  validates :delivery_order_id, presence: true
12
14
  validates :order_item_id, presence: true
13
15
  validates :quantity, presence: true, numericality: {greater_than: 0}
@@ -69,7 +69,7 @@ module Dscf
69
69
  return unless attachment.present?
70
70
  return if attachment.respond_to?(:attached?) && !attachment.attached?
71
71
 
72
- Rails.application.routes.url_helpers.rails_blob_url(attachment, **active_storage_url_options)
72
+ Rails.application.routes.url_helpers.rails_storage_proxy_url(attachment, **active_storage_url_options)
73
73
  end
74
74
 
75
75
  def active_storage_url_options
@@ -6,6 +6,8 @@ module Dscf
6
6
  belongs_to :product, class_name: "Dscf::Marketplace::Product"
7
7
  belongs_to :unit, class_name: "Dscf::Marketplace::Unit"
8
8
 
9
+ delegate :thumbnail_url, :images_urls, to: :product, allow_nil: true
10
+
9
11
  validates :product_id, presence: true
10
12
  validates :quantity, presence: true, numericality: {greater_than: 0}
11
13
  validates :unit_id, presence: true
@@ -7,6 +7,8 @@ module Dscf
7
7
 
8
8
  has_many :quotation_items, class_name: "Dscf::Marketplace::QuotationItem", dependent: :destroy
9
9
 
10
+ delegate :thumbnail_url, :images_urls, to: :product, allow_nil: true
11
+
10
12
  validates :quantity, presence: true, numericality: {greater_than: 0}
11
13
  validates :notes, length: {maximum: 1000}, allow_blank: true
12
14
 
@@ -81,7 +81,7 @@ module Dscf::Marketplace
81
81
  return [] unless documents.attached?
82
82
 
83
83
  documents.map do |doc|
84
- Rails.application.routes.url_helpers.rails_blob_url(doc, only_path: true)
84
+ Rails.application.routes.url_helpers.rails_storage_proxy_url(doc, only_path: true)
85
85
  end
86
86
  end
87
87
 
@@ -6,7 +6,8 @@ module Dscf
6
6
  :damaged_quantity, :missing_quantity, :receiver_confirmed_by,
7
7
  :receiver_confirmed_at, :receiver_notes, :handoff_checklist_completed,
8
8
  :created_at, :updated_at, :product_name, :unit_name, :verification_complete?,
9
- :has_discrepancy?, :discrepancy_amount, :requires_resolution?
9
+ :has_discrepancy?, :discrepancy_amount, :requires_resolution?,
10
+ :thumbnail_url, :images_urls
10
11
 
11
12
  belongs_to :delivery_order
12
13
  belongs_to :order_item
@@ -14,7 +14,7 @@ module Dscf
14
14
 
15
15
  url_options = Rails.application.config.x.active_storage_url_options || {}
16
16
  object.product_images.map do |image|
17
- Rails.application.routes.url_helpers.rails_blob_url(image, **url_options)
17
+ Rails.application.routes.url_helpers.rails_storage_proxy_url(image, **url_options)
18
18
  end
19
19
  end
20
20
 
@@ -5,7 +5,7 @@ module Dscf
5
5
  :unit_price, :subtotal, :created_at, :updated_at, :product_name,
6
6
  :product_sku, :unit_name, :unit_code, :rfq_requested_quantity,
7
7
  :quantity_difference, :quantity_difference_percentage, :price_per_base_unit,
8
- :matches_rfq_request?, :can_create_order?
8
+ :matches_rfq_request?, :can_create_order?, :thumbnail_url, :images_urls
9
9
 
10
10
  belongs_to :quotation
11
11
  belongs_to :rfq_item
@@ -3,7 +3,8 @@ module Dscf
3
3
  class RfqItemSerializer < ActiveModel::Serializer
4
4
  attributes :id, :request_for_quotation_id, :product_id, :unit_id, :quantity, :notes,
5
5
  :created_at, :updated_at, :product_name, :product_sku, :unit_name,
6
- :unit_code, :quotation_count, :has_quotations?, :quoted_price_range
6
+ :unit_code, :quotation_count, :has_quotations?, :quoted_price_range,
7
+ :thumbnail_url, :images_urls
7
8
 
8
9
  belongs_to :request_for_quotation
9
10
  belongs_to :product
@@ -8,7 +8,7 @@ module Dscf
8
8
  def business_license_url
9
9
  return nil unless object.business_license.attached?
10
10
 
11
- Rails.application.routes.url_helpers.rails_blob_url(object.business_license, only_path: true)
11
+ Rails.application.routes.url_helpers.rails_storage_proxy_url(object.business_license, only_path: true)
12
12
  end
13
13
  end
14
14
  end
@@ -1,5 +1,5 @@
1
1
  module Dscf
2
2
  module Marketplace
3
- VERSION = "0.9.7".freeze
3
+ VERSION = "0.9.8".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.9.7
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Asrat