cats_core 1.1.5 → 1.1.9

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: 1edf27e2257545cf71d59da4348838a7d413911a3977e505e9ea38788bbf6bc0
4
- data.tar.gz: 7b11450abaf98eed4cde168465e0f778be42026895d52883760bbe5cb0b571ae
3
+ metadata.gz: 1b8d65c21644b9d88b01ded686a1432c9f0ce96dc23dd302aa805de663396ab8
4
+ data.tar.gz: 654f7d01bc1134e647dae493931faf648083f2b27cffe6504d94a3775b121794
5
5
  SHA512:
6
- metadata.gz: 26de9f25dc8533a8ad33089cedacf51feff5b7ecfba6c08bfa55d811e7672cd4892955bccdd853a7281ec677a31478c9e3f8ecc2e421c79cbdeb34559b15c7d2
7
- data.tar.gz: 26c4b80b13de8a60a02545382205877c8a252beebf2943ca990860a5bd32652d1152b865a90940dc0a55eebfca1c3bde974bfb6dfa07addaf174c59a5e74674a
6
+ metadata.gz: c449b005efda44f929ca5ae00dc151b0824fd26d80abb01e8c64cb1e43ff7034139e2dee0aa7881306d9a42453b213a56cf54aaed153c7e282e7727ef1bbeab4
7
+ data.tar.gz: 8d846dccda8765c35d2a68f8bff83a6ea56aa6ffb992f7af2028ed9d2de5116d14c1ebc5e6f496934a803a65118c0c0bf6fd98061d1a220e0abe3bcced66ca06
@@ -4,7 +4,7 @@ module Cats
4
4
  include Common
5
5
 
6
6
  before_action :set_service, only: %i[create_receipt_authorization approve start search confirm]
7
- before_action :set_dispatch, only: %i[approve start confirm]
7
+ before_action :set_dispatch, only: %i[approve start confirm commodity]
8
8
 
9
9
  def index
10
10
  dispatches = Cats::Core::Dispatch.where(allocation_item_id: params[:id])
@@ -56,6 +56,11 @@ module Cats
56
56
  render json: { success: true, data: serialize(data) }
57
57
  end
58
58
 
59
+ def commodity
60
+ data = @dispatch.allocation_item.allocation.commodity
61
+ render json: { success: true, data: serialize(data) }
62
+ end
63
+
59
64
  private
60
65
 
61
66
  def set_service
@@ -17,10 +17,10 @@ module Cats
17
17
  render json: { success: false, error: e.message }
18
18
  end
19
19
 
20
- def stack
20
+ def finish_stacking
21
21
  receipt = Cats::Core::Receipt.find(params[:id])
22
22
  service = ReceiptService.new
23
- result = service.stack(receipt)
23
+ result = service.finish_stacking(receipt)
24
24
  render json: { success: true, data: serialize(result) }
25
25
  rescue StandardError => e
26
26
  render json: { success: false, error: e.message }
@@ -0,0 +1,9 @@
1
+ module Cats
2
+ module Core
3
+ class CommoditySerializer < ActiveModel::Serializer
4
+ attributes :id, :batch_no, :description, :unit_of_measure_id, :unit_of_measure_abbreviation, :source_id,
5
+ :source_type, :source_reference_no, :quantity, :best_use_before, :volume_per_metric_ton,
6
+ :commodity_category_id, :commodity_category_name, :arrival_status, :approved
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  class LocationSerializer < ActiveModel::Serializer
2
- attributes :id, :name, :location_type, :description, :parent_id
2
+ attributes :id, :code, :name, :location_type, :description, :parent_id
3
3
  end
@@ -11,7 +11,7 @@ module Cats
11
11
  receipt
12
12
  end
13
13
 
14
- def stack(receipt)
14
+ def finish_stacking(receipt)
15
15
  unless receipt.status == Cats::Core::Receipt::STACKING
16
16
  raise(StandardError, 'Receipt should be in stacking state.')
17
17
  end
data/config/routes.rb CHANGED
@@ -60,6 +60,7 @@ Cats::Core::Engine.routes.draw do
60
60
  resources :dispatches, except: %i[index destroy] do
61
61
  member do
62
62
  get 'receipts', controller: :receipts, action: :index
63
+ get 'commodity'
63
64
  post 'approve'
64
65
  post 'start'
65
66
  post 'confirm'
@@ -69,7 +70,7 @@ Cats::Core::Engine.routes.draw do
69
70
  resources :receipts, except: %i[index new edit destroy] do
70
71
  member do
71
72
  post 'start_stacking'
72
- post 'stack'
73
+ post 'finish_stacking'
73
74
  end
74
75
  end
75
76
  resources :receipt_transactions, except: %i[new edit destroy]
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.1.5'.freeze
3
+ VERSION = '1.1.9'.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.1.5
4
+ version: 1.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-26 00:00:00.000000000 Z
11
+ date: 2021-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -273,6 +273,7 @@ files:
273
273
  - app/models/cats/core/user.rb
274
274
  - app/notifications/cats/core/simple_notification.rb
275
275
  - app/serializers/cats/core/commodity_category_serializer.rb
276
+ - app/serializers/cats/core/commodity_serializer.rb
276
277
  - app/serializers/cats/core/currency_serializer.rb
277
278
  - app/serializers/cats/core/dispatch_serializer.rb
278
279
  - app/serializers/cats/core/dispatch_transaction_serializer.rb