cats_core 1.3.30 → 1.3.34

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: c112c544d162d0328402147a79d75517f52343b90a2b88e68c467e6538b48c56
4
- data.tar.gz: 42109ceb645c5b50202888495c3da96baffc0b61e516c979ce909ae2e6291ee7
3
+ metadata.gz: 7b0c7113546e6093fdfa62ac107260f1d635a66b47cbc28f9b460a9f12c3b694
4
+ data.tar.gz: 024d626dc5938173ce6ec2304dc819a221505851d9ff97138bb574972245a6ac
5
5
  SHA512:
6
- metadata.gz: aa66e8fcfd14abd48c36d7d923b002bbc399ab6959ec5b56210f918c1fc2a1ab25cfd54807f026641fb8d74142dee9a005f4bb9719bdf654f6af1b3de74eaa16
7
- data.tar.gz: ccfa85eb0ec3a870608678107c8e23721b2b41d637d0c2b61140c6b71d66d25e9240fef59a1e2ee88b77077c681a85dde90beedc380dd42555d97a01663a10c4
6
+ metadata.gz: 681671a2f33513d2c0b84bc8bf211643877ab9a8815d8dee9c73abe69bb752312afd1bc671a9b28d958ad904dccc6e07e31a3d3700558a901d7178b9d23fe716
7
+ data.tar.gz: 9c984fba4dc689c33511bc2dc29af1dc505f9d8b97303d9c91a12cdc12284486c39db6a805b08fe068c116ba7e7912dfa5e7a25b9b0122e06cf06d7a17f08ac9
@@ -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)
@@ -14,6 +14,10 @@ module Cats
14
14
  validates :authorization_type, inclusion: { in: AUTHORIZATION_TYPES }
15
15
  validate :validate_quantity, on: %i[create update]
16
16
 
17
+ delegate(:plan_reference_no, to: :dispatch_plan_item)
18
+ delegate(:full_name, to: :authorized_by, prefix: true)
19
+ delegate(:name, to: :store, prefix: true)
20
+
17
21
  def validate_quantity
18
22
  return unless quantity
19
23
 
@@ -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.30'.freeze
3
+ VERSION = '1.3.34'.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.30
4
+ version: 1.3.34
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