cats_core 1.0.21 → 1.0.22
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7847bbf4c0a83ac387d2b9e7bc1f8f4b4ffe184d12f9611ee60c6f14d1fe3078
|
4
|
+
data.tar.gz: 319c387eeddbd6342b1b4fe14ea921e7c3e686243feded978cad60d96c9756ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ec1c786270a96caa0097f2cd8c95d4a14e88b255d2def862f246770c36fd6956fc6b9e401ea931c4a306c0444c1ca9487fd64439769810249730c407b1e2ecb
|
7
|
+
data.tar.gz: eafd2a9293936dab8f7130c9428598fdc88fffb4b7a294e3f381fb08f985d9b379e5d268aa340ab5cfce4952da6c6b10b8b4b829cce8309268f48fb26de3b7ba
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Cats
|
2
|
+
module Core
|
3
|
+
class CurrenciesController < ApplicationController
|
4
|
+
before_action :set_currency, only: %i[show update]
|
5
|
+
|
6
|
+
def index
|
7
|
+
data = ActiveModelSerializers::SerializableResource.new(Cats::Core::Currency.all)
|
8
|
+
render json: { success: true, data: data }
|
9
|
+
end
|
10
|
+
|
11
|
+
def show
|
12
|
+
data = ActiveModelSerializers::SerializableResource.new(@currency)
|
13
|
+
render json: { success: true, data: data }
|
14
|
+
end
|
15
|
+
|
16
|
+
def create
|
17
|
+
obj = Cats::Core::Currency.new(model_params)
|
18
|
+
if obj.save
|
19
|
+
data = ActiveModelSerializers::SerializableResource.new(obj)
|
20
|
+
render json: { success: true, data: data }, status: :created
|
21
|
+
else
|
22
|
+
render json: { success: false, error: obj.errors.full_messages[0] }, status: :unprocessable_entity
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def update
|
27
|
+
if @currency.update(model_params)
|
28
|
+
data = ActiveModelSerializers::SerializableResource.new(@currency)
|
29
|
+
render json: { success: true, data: data }
|
30
|
+
else
|
31
|
+
render json: { success: false, error: @currency.errors.full_messages[0] }, status: :unprocessable_entity
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def set_currency
|
38
|
+
@currency = Cats::Core::Currency.find(params[:id])
|
39
|
+
end
|
40
|
+
|
41
|
+
def model_params
|
42
|
+
params.require(:payload).permit(:code, :name)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/config/routes.rb
CHANGED
data/lib/cats/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cats_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
@@ -219,6 +219,7 @@ files:
|
|
219
219
|
- app/controllers/cats/core/access_controller.rb
|
220
220
|
- app/controllers/cats/core/application_controller.rb
|
221
221
|
- app/controllers/cats/core/commodity_categories_controller.rb
|
222
|
+
- app/controllers/cats/core/currencies_controller.rb
|
222
223
|
- app/controllers/cats/core/locations_controller.rb
|
223
224
|
- app/controllers/cats/core/menus_controller.rb
|
224
225
|
- app/controllers/cats/core/notifications_controller.rb
|
@@ -261,6 +262,7 @@ files:
|
|
261
262
|
- app/models/cats/core/user.rb
|
262
263
|
- app/notifications/cats/core/simple_notification.rb
|
263
264
|
- app/serializers/cats/core/commodity_category_serializer.rb
|
265
|
+
- app/serializers/cats/core/currency_serializer.rb
|
264
266
|
- app/serializers/cats/core/location_serializer.rb
|
265
267
|
- app/serializers/cats/core/role_menu_serializer.rb
|
266
268
|
- app/services/cats/core/menu_service.rb
|