dscf-marketplace 0.2.99 → 0.3.0

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: c6a085b77e0df306ff423707aef06677341c982e2583981b5cb29af086e49a02
4
+ data.tar.gz: 1fe59b7b90e392c0719a53e58da437a45e49627655ace2c9ee83e6cb32501c0a
5
5
  SHA512:
6
- metadata.gz: 32a35f9601525853e8b2f8ec0d4d0a5fdb3bb8b40d0c6caddd88c7565057efcbb02fe544b877b25618634332c8d5468b32a16dec6709e49c13798f66fed5ed6f
7
- data.tar.gz: 8d744415e4936f1aeb6a0916e46ebdcf8786437735b05d0797d3ed2dbd0e49ddf4542ce758960cd84e75bb92c2cbe1d2227ee2b96df31ed91b65ba3e511c8aca
6
+ metadata.gz: a8bd980e7ba25145aebdedf2a3d759aefcd1df8a85af56c7740f22fb4a3ab9c90e045049ae596efdd34eab2d571e32fa16edcd0a4ec294437da93bf313a92a50
7
+ data.tar.gz: 7f6cd84b1f789ed6f770ad71f4b47c3d6599307622b46385119898f077c569813e1e0f5f3dacbc1c71609fe05fdacc165b0727021f41ecbf0de04974554da6f5
@@ -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
@@ -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
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.0".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.99
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Asrat