cats_core 1.3.31 → 1.3.35

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: bf517b4f0fd512472ced053c4f283d19c661fe849c7331163cf6e321ddd5ebe6
4
- data.tar.gz: 7b09f3a11ad9ef8d5ded20a2c5e7d4b7b09b1e27a06565462fc5f59d7fed163e
3
+ metadata.gz: 14d27580f8a6838cc0d85c02f007d1d56eabf1a7558e73e1eda4425171ba0f85
4
+ data.tar.gz: 3ec9b121fe5f861bd4989b5535439d5b53508622ffc7f01cf9051e95040f4b51
5
5
  SHA512:
6
- metadata.gz: '0818b51b0f8b75240043aff989521a71d641be5b4c4a0dc7eec7c47f40643a867c692cdee3faca3adc279503df252a2e2d68d453ec3f7a230f9f06a42d6b537e'
7
- data.tar.gz: dfe92285182fd027eb1f0d87186e3a122301c0d611748bb05708d76891e1dc8832b56c0b3ea8ab44adc557a0a3b27b99b6981ae815c4e7331bcce9c44c28d984
6
+ metadata.gz: fc0f7f07e690728a732e2b8389cc58dcd0b4fdd688ec41dd3168a62c6e90fc6ad984e3e04cf8e2f67028584dfc88d5d97d1d9d38a0482a4cd0f6028063ebf7e9
7
+ data.tar.gz: e9d43cd5878520d23ff59cbd1eaa3e62bfa71d5ee16266c77b5f45c77eaab91566e40f6bf59f33292e6b3192663084f92ab331911163c37be092bb20b4ccbc99
@@ -16,6 +16,10 @@ module Cats
16
16
 
17
17
  private
18
18
 
19
+ def serialize(data)
20
+ ActiveModelSerializers::SerializableResource.new(data)
21
+ end
22
+
19
23
  def token
20
24
  return nil if request.env['HTTP_AUTHORIZATION'].nil?
21
25
 
@@ -9,6 +9,11 @@ module Cats
9
9
  render json: { success: true, data: data }
10
10
  end
11
11
 
12
+ def root
13
+ data = Cats::Core::CommodityCategory.roots
14
+ render json: { success: true, data: serialize(data) }
15
+ end
16
+
12
17
  def show
13
18
  data = ActiveModelSerializers::SerializableResource.new(@commodity_category)
14
19
  render json: { success: true, data: data }
@@ -19,7 +19,7 @@ module Cats
19
19
  validates :unit_of_measure, presence: true, if: -> { donation_type == KIND }
20
20
 
21
21
  delegate(:name, to: :donor, prefix: true)
22
- delegate(:reference_no, to: :plan, prefix: true)
22
+ delegate(:reference_no, to: :plan, prefix: true, allow_nil: true)
23
23
  delegate(:name, to: :commodity_category, prefix: true, allow_nil: true)
24
24
  delegate(:code, to: :currency, prefix: true, allow_nil: true)
25
25
  delegate(:abbreviation, to: :unit_of_measure, prefix: true, allow_nil: true)
@@ -5,6 +5,10 @@ module Cats
5
5
  belongs_to :monthly_ration
6
6
 
7
7
  validates :amount, presence: true, numericality: { greater_than: 0 }
8
+
9
+ delegate(:commodity_category_name, to: :monthly_ration)
10
+ delegate(:unit_of_measure_abbreviation, to: :monthly_ration)
11
+ delegate(:no_of_days, to: :monthly_ration)
8
12
  end
9
13
  end
10
14
  end
data/config/routes.rb CHANGED
@@ -59,6 +59,7 @@ Cats::Core::Engine.routes.draw do
59
59
  as: :store_space,
60
60
  defaults: { level: Cats::Core::SpaceService::STORE }
61
61
 
62
+ get '/commodity_categories/roots', to: 'commodity_categories#root', as: :commodity_category_roots
62
63
  resources :commodity_categories, except: %i[destroy] do
63
64
  member do
64
65
  get 'children'
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.3.31'.freeze
3
+ VERSION = '1.3.35'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cats_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.31
4
+ version: 1.3.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-10 00:00:00.000000000 Z
11
+ date: 2022-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers