cats_core 1.1.5 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/app/controllers/cats/core/dispatches_controller.rb +6 -1
 - data/app/controllers/cats/core/receipts_controller.rb +2 -2
 - data/app/serializers/cats/core/commodity_serializer.rb +9 -0
 - data/app/serializers/cats/core/location_serializer.rb +1 -1
 - data/app/services/cats/core/receipt_service.rb +1 -1
 - data/config/routes.rb +2 -1
 - data/lib/cats/core/version.rb +1 -1
 - metadata +3 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 1b8d65c21644b9d88b01ded686a1432c9f0ce96dc23dd302aa805de663396ab8
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 654f7d01bc1134e647dae493931faf648083f2b27cffe6504d94a3775b121794
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 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  
     | 
| 
      
 20 
     | 
    
         
            +
                  def finish_stacking
         
     | 
| 
       21 
21 
     | 
    
         
             
                    receipt = Cats::Core::Receipt.find(params[:id])
         
     | 
| 
       22 
22 
     | 
    
         
             
                    service = ReceiptService.new
         
     | 
| 
       23 
     | 
    
         
            -
                    result = service. 
     | 
| 
      
 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
         
     | 
    
        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 ' 
     | 
| 
      
 73 
     | 
    
         
            +
                  post 'finish_stacking'
         
     | 
| 
       73 
74 
     | 
    
         
             
                end
         
     | 
| 
       74 
75 
     | 
    
         
             
              end
         
     | 
| 
       75 
76 
     | 
    
         
             
              resources :receipt_transactions, except: %i[new edit destroy]
         
     | 
    
        data/lib/cats/core/version.rb
    CHANGED
    
    
    
        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. 
     | 
| 
      
 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- 
     | 
| 
      
 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
         
     |