comee_core 0.2.16 → 0.2.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/comee/core/customer_orders_controller.rb +1 -1
- data/app/controllers/comee/core/sales_order_items_controller.rb +6 -0
- data/app/controllers/comee/core/sales_orders_controller.rb +7 -1
- data/app/controllers/concerns/comee/core/common.rb +42 -12
- data/config/routes.rb +1 -0
- data/lib/comee/core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a22a79a452e5e9f9f66bf84f7fd4d986765f2fe7d9fbc9e228b8cf6963a33d4
|
4
|
+
data.tar.gz: ca63072349143672a4e0e20eaf3ed5668414d1a36e7cebccea91efd9779c2f71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0c350b679889199287028a5ca3fe90e70f1b3f78ee9eb204793f782dbdea1880e878bae5b6715b0f00f148781fcdf950e1383c5818b47019d2159b8f5a440ae
|
7
|
+
data.tar.gz: e660b422111cb6e69c8befe2e0e8e2fc28a91b3fe9376fc491b7ac933db352eb31cb0977f28d8998d9499c3d0890f44a82dbbcdd0997fb2dbf8cb2b52b16219e
|
@@ -23,13 +23,19 @@ module Comee
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
def update
|
27
|
+
super do
|
28
|
+
{fields: ["client", "customer_order", "sales_order_items", "sales_order_items.product", "sales_order_items.unit"]}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
26
32
|
def filter
|
27
33
|
data = SalesOrder.includes(
|
28
34
|
:customer_order,
|
29
35
|
:client,
|
30
36
|
sales_order_items: :unit
|
31
37
|
).ransack(params[:q]).result
|
32
|
-
render_content(data)
|
38
|
+
render_content(data, fields: ["client", "customer_order", "sales_order_items.product", "sales_order_items.unit"])
|
33
39
|
end
|
34
40
|
|
35
41
|
def submit
|
@@ -61,13 +61,28 @@ module Comee
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def create
|
64
|
-
obj =
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
64
|
+
obj = nil
|
65
|
+
options = {}
|
66
|
+
if block_given?
|
67
|
+
incoming = yield
|
68
|
+
if incoming.instance_of?(Array)
|
69
|
+
obj, options = incoming
|
70
|
+
elsif incoming.instance_of?(Hash)
|
71
|
+
obj = @clazz.new(model_params)
|
72
|
+
options = incoming
|
73
|
+
else
|
74
|
+
obj = incoming
|
75
|
+
end
|
76
|
+
else
|
77
|
+
obj = @clazz.new(model_params)
|
78
|
+
end
|
79
|
+
|
69
80
|
if obj.save
|
70
|
-
|
81
|
+
result = {
|
82
|
+
success: true,
|
83
|
+
data: options.key?(:fields) ? serialize(obj, include: options[:fields]) : serialize(obj)
|
84
|
+
}
|
85
|
+
render json: result, status: :created
|
71
86
|
else
|
72
87
|
render json: {success: false, error: obj.errors.full_messages[0]}, status: :unprocessable_entity
|
73
88
|
end
|
@@ -76,13 +91,28 @@ module Comee
|
|
76
91
|
end
|
77
92
|
|
78
93
|
def update
|
79
|
-
obj =
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
94
|
+
obj = nil
|
95
|
+
options = {}
|
96
|
+
if block_given?
|
97
|
+
incoming = yield
|
98
|
+
if incoming.instance_of?(Array)
|
99
|
+
obj, options = incoming
|
100
|
+
elsif incoming.instance_of?(Hash)
|
101
|
+
obj = set_object
|
102
|
+
options = incoming
|
103
|
+
else
|
104
|
+
obj = incoming
|
105
|
+
end
|
106
|
+
else
|
107
|
+
obj = set_object
|
108
|
+
end
|
109
|
+
|
84
110
|
if obj.update(model_params)
|
85
|
-
|
111
|
+
result = {
|
112
|
+
success: true,
|
113
|
+
data: options.key?(:fields) ? serialize(obj, include: options[:fields]) : serialize(obj)
|
114
|
+
}
|
115
|
+
render json: result
|
86
116
|
else
|
87
117
|
render json: {success: false, error: obj.errors.full_messages[0]}, status: :unprocessable_entity
|
88
118
|
end
|
data/config/routes.rb
CHANGED
data/lib/comee/core/version.rb
CHANGED
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.
|
4
|
+
version: 0.2.18
|
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-02-
|
11
|
+
date: 2024-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|