comee_core 0.2.54 → 0.2.55

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3a703914e5326d261f0c943c3b75d53ff8c4b87f1b25cddb5ea874206ffc04d
4
- data.tar.gz: 15b4815aca29b0d972da7dc05b56bca36853397d1b9f418a36e6b5b1f47f3318
3
+ metadata.gz: 153d3be4849a2a61ea05ee49995fdaf2c246263a2c579e9f9754f199fa4eb591
4
+ data.tar.gz: 988d4d60cc82d4f0d31331105f593457bd64f78f169d1d9ed0c8964eca4e358e
5
5
  SHA512:
6
- metadata.gz: 8f0819b6d18e43ed9a5c3935ad4ff0ea4ca2c98188240b21c678b53903a27610cf6613dff8499b0c2cfbd878c57c08f85baf189763f6bfcc756257291cc9e191
7
- data.tar.gz: f69e7f88ac237fa4788f0e161647b9046eeba570f22a451baf054348d326c410e54fa3d8e1125c5cf7bdf2fb52766c996b1a1199691e812ed5489fce5e70877c
6
+ metadata.gz: 0b14faed0811d25bdf08880f30bc753295b7250c1c1d7aaabc529de8c5387484d8c28e2c79dc5449b8c50925ca8bacdaff0c34b925180ae7df2bf69e3900ef59
7
+ data.tar.gz: 7845a9cddf77861a89b3b7fc4dd50e7449fc768d0cc6b6a92bf3675360bde9b4041a203219d4a18f227a2e44e1b6990f05c1d4ed078b70a81cfe162474d41a1b
@@ -13,15 +13,16 @@ module Comee
13
13
  result[:page] = params[:page].to_i
14
14
  result[:total] = total
15
15
  end
16
- result[:data] = if options.key?(:fields) && options.key?(:serializer)
17
- serialize(data, {include: options[:fields], serializer: options[:serializer]})
18
- elsif options.key?(:fields) && options.key?(:each_serializer)
19
- serialize(data, {include: options[:fields], each_serializer: options[:each_serializer]})
20
- elsif options.key?(:fields)
21
- serialize(data, {include: options[:fields]})
22
- else
23
- serialize(data)
24
- end
16
+ # result[:data] = if options.key?(:fields) && options.key?(:serializer)
17
+ # serialize(data, {include: options[:fields], serializer: options[:serializer]})
18
+ # elsif options.key?(:fields) && options.key?(:each_serializer)
19
+ # serialize(data, {include: options[:fields], each_serializer: options[:each_serializer]})
20
+ # elsif options.key?(:fields)
21
+ # serialize(data, {include: options[:fields]})
22
+ # else
23
+ # serialize(data)
24
+ # end
25
+ result[:data] = serialize(data, options)
25
26
  render json: result
26
27
  end
27
28
 
@@ -7,7 +7,7 @@ module Comee
7
7
  super do
8
8
  [
9
9
  CustomerOrderItem.includes(:product, :unit).all,
10
- fields: ["unit"]
10
+ include: ["unit"]
11
11
  ]
12
12
  end
13
13
  end
@@ -19,7 +19,7 @@ module Comee
19
19
 
20
20
  def filter
21
21
  data = CustomerOrderItem.includes(:product, :unit).ransack(params[:q]).result
22
- render_content(data, {fields: ["unit"]})
22
+ render_content(data, {include: ["unit"]})
23
23
  end
24
24
 
25
25
  def destroy
@@ -9,7 +9,7 @@ module Comee
9
9
  super do
10
10
  [
11
11
  CustomerOrder.includes(:client, customer_order_items: :unit).order(:created_at),
12
- fields: ["client", "customer_order_items.unit"]
12
+ include: ["client", "customer_order_items.unit"]
13
13
  ]
14
14
  end
15
15
  end
@@ -18,7 +18,7 @@ module Comee
18
18
  super do
19
19
  [
20
20
  CustomerOrder.includes(:client, customer_order_items: :unit).find(params[:id]),
21
- fields: ["client", "customer_order_items.unit"]
21
+ include: ["client", "customer_order_items.unit"]
22
22
  ]
23
23
  end
24
24
  end
@@ -58,7 +58,7 @@ module Comee
58
58
 
59
59
  def filter
60
60
  orders = CustomerOrder.includes(:client, :customer_order_items).ransack(params[:q]).result
61
- render_content(orders, fields: ["client", "customer_order_items.unit"])
61
+ render_content(orders, include: ["client", "customer_order_items.unit"])
62
62
  end
63
63
 
64
64
  private
@@ -21,7 +21,7 @@ module Comee
21
21
  render_content(
22
22
  details,
23
23
  {
24
- fields: ["shipment_items.item_statuses", "purchase_order_item.purchase_order"],
24
+ include: ["shipment_items.item_statuses", "purchase_order_item.purchase_order"],
25
25
  serializer: SalesOrderItemDetailSerializer
26
26
  }
27
27
  )
@@ -14,7 +14,7 @@ module Comee
14
14
  ).order(created_at: :desc)
15
15
  [
16
16
  data,
17
- fields: [
17
+ include: [
18
18
  "client",
19
19
  "customer_order",
20
20
  "sales_order_items",
@@ -30,7 +30,7 @@ module Comee
30
30
  super do
31
31
  [
32
32
  SalesOrder.includes(:customer_order, :client, :customs_detail, sales_order_items: :unit).find(params[:id]),
33
- fields: [
33
+ include: [
34
34
  "client",
35
35
  "customer_order",
36
36
  "sales_order_items",
@@ -44,7 +44,7 @@ module Comee
44
44
 
45
45
  def update
46
46
  super do
47
- {fields: ["client", "customer_order", "sales_order_items", "sales_order_items.product", "sales_order_items.unit"]}
47
+ {include: ["client", "customer_order", "sales_order_items", "sales_order_items.product", "sales_order_items.unit"]}
48
48
  end
49
49
  end
50
50
 
@@ -57,7 +57,7 @@ module Comee
57
57
  ).ransack(params[:q]).result
58
58
  render_content(
59
59
  data,
60
- fields: ["client", "customer_order", "sales_order_items.product", "sales_order_items.unit", "customs_detail"]
60
+ include: ["client", "customer_order", "sales_order_items.product", "sales_order_items.unit", "customs_detail"]
61
61
  )
62
62
  end
63
63
 
@@ -7,14 +7,14 @@ module Comee
7
7
  super do
8
8
  [
9
9
  ShipmentItem.includes(sales_order_item: [sales_order: :client]).all,
10
- fields: ["sales_order_item.sales_order.client"]
10
+ include: ["sales_order_item.sales_order.client"]
11
11
  ]
12
12
  end
13
13
  end
14
14
 
15
15
  def filter
16
16
  shipment_item = ShipmentItem.includes(:sales_order_item).ransack(params[:q]).result
17
- options = {fields: ["sales_order_item.sales_order.client", "sales_order_item.product", "sales_order_item.unit"]}
17
+ options = {include: ["sales_order_item.sales_order.client", "sales_order_item.product", "sales_order_item.unit"]}
18
18
  render_content(shipment_item, options)
19
19
  end
20
20
 
@@ -28,7 +28,7 @@ module Comee
28
28
  data = data.then(&paginate) if params[:page]
29
29
  result = {
30
30
  success: true,
31
- data: options.key?(:fields) ? serialize(data, include: options[:fields]) : serialize(data)
31
+ data: serialize(data, options)
32
32
  }
33
33
  if params[:page]
34
34
  result[:page] = params[:page]
@@ -56,7 +56,7 @@ module Comee
56
56
  end
57
57
  result = {
58
58
  success: true,
59
- data: options.key?(:fields) ? serialize(data, include: options[:fields]) : serialize(data)
59
+ data: serialize(data, options)
60
60
  }
61
61
  render json: result
62
62
  end
@@ -81,7 +81,7 @@ module Comee
81
81
  if obj.save
82
82
  result = {
83
83
  success: true,
84
- data: options.key?(:fields) ? serialize(obj, include: options[:fields]) : serialize(obj)
84
+ data: serialize(obj, options)
85
85
  }
86
86
  render json: result, status: :created
87
87
  else
@@ -111,7 +111,7 @@ module Comee
111
111
  if obj.update(model_params)
112
112
  result = {
113
113
  success: true,
114
- data: options.key?(:fields) ? serialize(obj, include: options[:fields]) : serialize(obj)
114
+ data: serialize(obj, options)
115
115
  }
116
116
  render json: result
117
117
  else
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.2.54".freeze
3
+ VERSION = "0.2.55".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comee_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.54
4
+ version: 0.2.55
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.