comee_core 0.2.53 → 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: cbd504feaf226234a948351b3f05dc7e4bebedbb77943f990c909b49c522b35e
4
- data.tar.gz: 16479be863225ad791359456c2aeb019a71304b40478fc5fb478a4309600be95
3
+ metadata.gz: 153d3be4849a2a61ea05ee49995fdaf2c246263a2c579e9f9754f199fa4eb591
4
+ data.tar.gz: 988d4d60cc82d4f0d31331105f593457bd64f78f169d1d9ed0c8964eca4e358e
5
5
  SHA512:
6
- metadata.gz: 5d7dc57f1d6b2d96de96a0f81dcffeddfd89b0b311f71adb88acc5b66a4f8a0d0e2031a2af3ea21f23b4133c75c19a9d4ea3943e62d14a8ceea0093a1a8a88f2
7
- data.tar.gz: 7455743f13220ab7add40bb70450fbd73c588c37f9caeebde3a89e90548cb2e4b574ef38a0a664f3a9605d030447260020d7d555c8f716df05dea12a1d69eb68
6
+ metadata.gz: 0b14faed0811d25bdf08880f30bc753295b7250c1c1d7aaabc529de8c5387484d8c28e2c79dc5449b8c50925ca8bacdaff0c34b925180ae7df2bf69e3900ef59
7
+ data.tar.gz: 7845a9cddf77861a89b3b7fc4dd50e7449fc768d0cc6b6a92bf3675360bde9b4041a203219d4a18f227a2e44e1b6990f05c1d4ed078b70a81cfe162474d41a1b
@@ -13,8 +13,16 @@ module Comee
13
13
  result[:page] = params[:page].to_i
14
14
  result[:total] = total
15
15
  end
16
- result[:data] = options.key?(:fields) ? serialize(data, include: options[:fields]) : serialize(data)
17
-
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)
18
26
  render json: result
19
27
  end
20
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
@@ -18,16 +18,13 @@ module Comee
18
18
  def shipment_details
19
19
  details = SalesOrderItem.includes(shipment_items: :item_statuses, purchase_order_item: :purchase_order)
20
20
  .find(params[:id])
21
- data = ActiveModelSerializers::SerializableResource.new(
21
+ render_content(
22
22
  details,
23
23
  {
24
- serializer: SalesOrderItemDetailSerializer,
25
- include: ["shipment_items.item_statuses", "purchase_order_item.purchase_order"]
24
+ include: ["shipment_items.item_statuses", "purchase_order_item.purchase_order"],
25
+ serializer: SalesOrderItemDetailSerializer
26
26
  }
27
27
  )
28
- render json: {success: true, data: data}
29
-
30
- # render_content(details, fields: ["shipment_items.item_statuses", "purchase_order_items.purchase_order"])
31
28
  end
32
29
 
33
30
  def suggest_values
@@ -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.53".freeze
3
+ VERSION = "0.2.55".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comee_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.53
4
+ version: 0.2.55
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-12 00:00:00.000000000 Z
11
+ date: 2024-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers