dscf-marketplace 0.2.99 → 0.3.1

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: f3149c8bf4129b29d6b05fe56bd6e05517db77cb8ca06eef00ec7fae37cc5d64
4
- data.tar.gz: 9c5e3d3f97ceb0503d07e0e35643ca81e7eb7fa6ea8a13ed5b5e85627c996ab7
3
+ metadata.gz: 57f9c4d2ecf400c38dca9a04818fa884e70933d5a9833cfd76ee08912c03fa42
4
+ data.tar.gz: 1a42fc07ec1149eadaa52daac11b1f77cb4682a6c5b0f0d74854070aea6944d0
5
5
  SHA512:
6
- metadata.gz: 32a35f9601525853e8b2f8ec0d4d0a5fdb3bb8b40d0c6caddd88c7565057efcbb02fe544b877b25618634332c8d5468b32a16dec6709e49c13798f66fed5ed6f
7
- data.tar.gz: 8d744415e4936f1aeb6a0916e46ebdcf8786437735b05d0797d3ed2dbd0e49ddf4542ce758960cd84e75bb92c2cbe1d2227ee2b96df31ed91b65ba3e511c8aca
6
+ metadata.gz: d1bdc4d7828489e905acb003d42dd8abddbc388a52a50aac8b5f3567cc4761e10bcb6bd3289748b99498afac7c628eb15c8175242affa7c18fd2d3428187cecc
7
+ data.tar.gz: 67b99bd82f5b9398696652d02aa0cfaa2d47bec843b7917c480d18dfd32e1b5b6eb11706d8a7c593ee1fa9f3fcb3f0bf2b3798c64bd437005a0420a1c8c9e0ba
@@ -45,6 +45,29 @@ module Dscf
45
45
  render_success(data: delivery_orders, serializer_options: options)
46
46
  end
47
47
 
48
+ def filter
49
+ delivery_orders = @clazz.all
50
+
51
+ # Apply Ransack filtering if q params present
52
+ if params[:q].present?
53
+ # Filter out any parameters that might reference JSON fields
54
+ filtered_params = params[:q].reject { |key, _| key.to_s.include?("optimized_route") }
55
+ if filtered_params.present?
56
+ delivery_orders = delivery_orders.ransack(filtered_params).result
57
+ end
58
+ end
59
+
60
+ # Apply eager loading
61
+ delivery_orders = delivery_orders.includes(eager_loaded_associations) if eager_loaded_associations.present?
62
+
63
+ # Add serializer includes
64
+ includes = serializer_includes_for_action(:index)
65
+ options = {}
66
+ options[:include] = includes if includes.present?
67
+
68
+ render_success(data: delivery_orders, serializer_options: options)
69
+ end
70
+
48
71
  def pickup
49
72
  @obj = find_record
50
73
  if @obj.pickup!
@@ -3,18 +3,23 @@ module Dscf
3
3
  class OrdersController < ApplicationController
4
4
  include Dscf::Core::Common
5
5
 
6
- def index
7
- super do
8
- # Get base query with proper filtering
9
- orders = @clazz.all
6
+ def filter
7
+ orders = @clazz.all
10
8
 
11
- # Apply Ransack filtering if q params present
12
- if params[:q].present?
13
- orders = orders.ransack(params[:q]).result
14
- end
15
-
16
- orders
9
+ # Apply Ransack filtering if q params present
10
+ if params[:q].present?
11
+ orders = orders.ransack(params[:q]).result
17
12
  end
13
+
14
+ # Apply eager loading
15
+ orders = orders.includes(eager_loaded_associations) if eager_loaded_associations.present?
16
+
17
+ # Add serializer includes
18
+ includes = serializer_includes_for_action(:index)
19
+ options = {}
20
+ options[:include] = includes if includes.present?
21
+
22
+ render_success(data: orders, serializer_options: options)
18
23
  end
19
24
 
20
25
  def confirm
@@ -3,6 +3,25 @@ module Dscf
3
3
  class ProductsController < ApplicationController
4
4
  include Dscf::Core::Common
5
5
 
6
+ def filter
7
+ products = @clazz.all
8
+
9
+ # Apply Ransack filtering if q params present
10
+ if params[:q].present?
11
+ products = products.ransack(params[:q]).result
12
+ end
13
+
14
+ # Apply eager loading
15
+ products = products.includes(eager_loaded_associations) if eager_loaded_associations.present?
16
+
17
+ # Add serializer includes
18
+ includes = serializer_includes_for_action(:index)
19
+ options = {}
20
+ options[:include] = includes if includes.present?
21
+
22
+ render_success(data: products, serializer_options: options)
23
+ end
24
+
6
25
  private
7
26
 
8
27
  def model_params
@@ -3,18 +3,23 @@ module Dscf
3
3
  class QuotationsController < ApplicationController
4
4
  include Dscf::Core::Common
5
5
 
6
- def index
7
- super do
8
- # Get base query with proper filtering
9
- quotations = @clazz.all
6
+ def filter
7
+ quotations = @clazz.all
10
8
 
11
- # Apply Ransack filtering if q params present
12
- if params[:q].present?
13
- quotations = quotations.ransack(params[:q]).result
14
- end
15
-
16
- quotations
9
+ # Apply Ransack filtering if q params present
10
+ if params[:q].present?
11
+ quotations = quotations.ransack(params[:q]).result
17
12
  end
13
+
14
+ # Apply eager loading
15
+ quotations = quotations.includes(eager_loaded_associations) if eager_loaded_associations.present?
16
+
17
+ # Add serializer includes
18
+ includes = serializer_includes_for_action(:index)
19
+ options = {}
20
+ options[:include] = includes if includes.present?
21
+
22
+ render_success(data: quotations, serializer_options: options)
18
23
  end
19
24
 
20
25
  def accept
@@ -58,6 +63,10 @@ module Dscf
58
63
 
59
64
  private
60
65
 
66
+ def find_record
67
+ @clazz.find(params[:id])
68
+ end
69
+
61
70
  def model_params
62
71
  params.require(:quotation).permit(
63
72
  :request_for_quotation_id, :business_id, :total_price,
@@ -3,18 +3,23 @@ module Dscf
3
3
  class RequestForQuotationsController < ApplicationController
4
4
  include Dscf::Core::Common
5
5
 
6
- def index
7
- super do
8
- # Get base query with proper filtering
9
- rfqs = @clazz.all
6
+ def filter
7
+ rfqs = @clazz.all
10
8
 
11
- # Apply Ransack filtering if q params present
12
- if params[:q].present?
13
- rfqs = rfqs.ransack(params[:q]).result
14
- end
15
-
16
- rfqs
9
+ # Apply Ransack filtering if q params present
10
+ if params[:q].present?
11
+ rfqs = rfqs.ransack(params[:q]).result
17
12
  end
13
+
14
+ # Apply eager loading
15
+ rfqs = rfqs.includes(eager_loaded_associations) if eager_loaded_associations.present?
16
+
17
+ # Add serializer includes
18
+ includes = serializer_includes_for_action(:index)
19
+ options = {}
20
+ options[:include] = includes if includes.present?
21
+
22
+ render_success(data: rfqs, serializer_options: options)
18
23
  end
19
24
 
20
25
  def create
@@ -78,6 +83,10 @@ module Dscf
78
83
 
79
84
  private
80
85
 
86
+ def find_record
87
+ @clazz.find(params[:id])
88
+ end
89
+
81
90
  def model_params
82
91
  params.require(:request_for_quotation).permit(
83
92
  :user_id, :selected_quotation_id, :status, :notes,
data/config/routes.rb CHANGED
@@ -8,6 +8,9 @@ Dscf::Marketplace::Engine.routes.draw do
8
8
  resources :products do
9
9
  resources :listings, only: [ :index ]
10
10
  get "supplier_products", on: :member
11
+ collection do
12
+ get "filter"
13
+ end
11
14
  end
12
15
 
13
16
  resources :units do
@@ -54,6 +57,7 @@ Dscf::Marketplace::Engine.routes.draw do
54
57
  end
55
58
  collection do
56
59
  get "my_rfqs"
60
+ get "filter"
57
61
  end
58
62
  end
59
63
 
@@ -68,6 +72,7 @@ Dscf::Marketplace::Engine.routes.draw do
68
72
  end
69
73
  collection do
70
74
  get "my_quotes"
75
+ get "filter"
71
76
  end
72
77
  end
73
78
 
@@ -83,6 +88,7 @@ Dscf::Marketplace::Engine.routes.draw do
83
88
  end
84
89
  collection do
85
90
  get "my_orders"
91
+ get "filter"
86
92
  end
87
93
  end
88
94
 
@@ -97,6 +103,9 @@ Dscf::Marketplace::Engine.routes.draw do
97
103
  post "complete_delivery"
98
104
  post "mark_failed"
99
105
  end
106
+ collection do
107
+ get "filter"
108
+ end
100
109
  end
101
110
 
102
111
  resources :delivery_order_items, only: [ :index, :show, :update, :create ] do
@@ -1,5 +1,5 @@
1
1
  module Dscf
2
2
  module Marketplace
3
- VERSION = "0.2.99".freeze
3
+ VERSION = "0.3.1".freeze
4
4
  end
5
5
  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.2.99
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Asrat
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-09-12 00:00:00.000000000 Z
10
+ date: 2025-09-14 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails