cats_core 1.3.35 → 1.3.36

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: 14d27580f8a6838cc0d85c02f007d1d56eabf1a7558e73e1eda4425171ba0f85
4
- data.tar.gz: 3ec9b121fe5f861bd4989b5535439d5b53508622ffc7f01cf9051e95040f4b51
3
+ metadata.gz: f7d2738616bb04e122c03cb503fe91bb1d8cb818c2ef909516d2e506efcad01c
4
+ data.tar.gz: 7363415368111fa228b7d552f030bdce90009940c62365a27b9408d29745a21b
5
5
  SHA512:
6
- metadata.gz: fc0f7f07e690728a732e2b8389cc58dcd0b4fdd688ec41dd3168a62c6e90fc6ad984e3e04cf8e2f67028584dfc88d5d97d1d9d38a0482a4cd0f6028063ebf7e9
7
- data.tar.gz: e9d43cd5878520d23ff59cbd1eaa3e62bfa71d5ee16266c77b5f45c77eaab91566e40f6bf59f33292e6b3192663084f92ab331911163c37be092bb20b4ccbc99
6
+ metadata.gz: c04a0d21b349fe67c2367204df7dc876bd0ec250753124873583b387f035fe1290a7bb503f8aad9184dd8df6fddd787aaa785fd0f1e281e12c4b0f2a6320871f
7
+ data.tar.gz: d0104ee1c25f2fa50e196c0daa671c30fbed484cb370116919bc01403e68d736595a0ab17c83f2b2f0921bff87d319840035f99ee6cfd3d20c55d93817a29595
@@ -0,0 +1,16 @@
1
+ module Cats
2
+ module Core
3
+ class LostCommoditiesController < ApplicationController
4
+ include Common
5
+
6
+ def index
7
+ data = LostCommodity.where(receipt_id: params[:id])
8
+ render json: { success: true, data: serialize(data) }
9
+ end
10
+
11
+ def model_params
12
+ params.require(:payload).permit(:receipt_id, :quantity, :commodity_status, :remark)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,10 @@
1
+ module Cats
2
+ module Core
3
+ class LostCommodity < ApplicationRecord
4
+ belongs_to :receipt
5
+
6
+ validates :quantity, presence: true
7
+ validates :commodity_status, presence: true, inclusion: { in: Commodity::COMMODITY_STATUSES }
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ module Cats
2
+ module Core
3
+ class LostCommoditySerializer < ActiveModel::Serializer
4
+ attributes :id, :receipt_id, :quantity, :commodity_status, :remark
5
+ end
6
+ end
7
+ end
data/config/routes.rb CHANGED
@@ -103,9 +103,11 @@ Cats::Core::Engine.routes.draw do
103
103
  resources :receipts, except: %i[index new edit destroy] do
104
104
  member do
105
105
  get 'transactions', controller: :receipt_transactions, action: :index
106
+ get 'lost', controller: :lost_commodities, action: :index
106
107
  post 'start_stacking'
107
108
  post 'finish_stacking'
108
109
  end
109
110
  end
110
111
  resources :receipt_transactions, except: %i[index new edit destroy]
112
+ resources :lost_commodities, except: %i[index destroy]
111
113
  end
@@ -0,0 +1,15 @@
1
+ class CreateCatsCoreLostCommodities < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :cats_core_lost_commodities do |t|
4
+ t.references :receipt,
5
+ null: false,
6
+ index: { name: 'lc_on_receipt_indx' },
7
+ foreign_key: { to_table: :cats_core_receipts }
8
+ t.float :quantity, null: false
9
+ t.string :commodity_status, null: false
10
+ t.string :remark
11
+
12
+ t.timestamps
13
+ end
14
+ end
15
+ end
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.3.35'.freeze
3
+ VERSION = '1.3.36'.freeze
4
4
  end
5
5
  end
@@ -0,0 +1,8 @@
1
+ FactoryBot.define do
2
+ factory :lost_commodity, class: 'Cats::Core::LostCommodity' do
3
+ receipt
4
+ quantity { 100 }
5
+ commodity_status { Cats::Core::Commodity::DAMAGED }
6
+ remark { FFaker::Name.name }
7
+ end
8
+ 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.35
4
+ version: 1.3.36
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-20 00:00:00.000000000 Z
11
+ date: 2022-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -239,6 +239,7 @@ files:
239
239
  - app/controllers/cats/core/dispatch_transactions_controller.rb
240
240
  - app/controllers/cats/core/dispatches_controller.rb
241
241
  - app/controllers/cats/core/locations_controller.rb
242
+ - app/controllers/cats/core/lost_commodities_controller.rb
242
243
  - app/controllers/cats/core/menus_controller.rb
243
244
  - app/controllers/cats/core/notifications_controller.rb
244
245
  - app/controllers/cats/core/receipt_transactions_controller.rb
@@ -269,6 +270,7 @@ files:
269
270
  - app/models/cats/core/gift_certificate.rb
270
271
  - app/models/cats/core/hub_authorization.rb
271
272
  - app/models/cats/core/location.rb
273
+ - app/models/cats/core/lost_commodity.rb
272
274
  - app/models/cats/core/menu.rb
273
275
  - app/models/cats/core/menu_item.rb
274
276
  - app/models/cats/core/monthly_plan.rb
@@ -320,6 +322,7 @@ files:
320
322
  - app/serializers/cats/core/dispatch_serializer.rb
321
323
  - app/serializers/cats/core/dispatch_transaction_serializer.rb
322
324
  - app/serializers/cats/core/location_serializer.rb
325
+ - app/serializers/cats/core/lost_commodity_serializer.rb
323
326
  - app/serializers/cats/core/receipt_serializer.rb
324
327
  - app/serializers/cats/core/receipt_transaction_serializer.rb
325
328
  - app/serializers/cats/core/role_menu_serializer.rb
@@ -393,6 +396,7 @@ files:
393
396
  - db/migrate/20220107125025_create_cats_core_monthly_plan_items.rb
394
397
  - db/migrate/20220107132433_create_cats_core_monthly_plan_item_details.rb
395
398
  - db/migrate/20220209083928_create_cats_core_hub_authorizations.rb
399
+ - db/migrate/20220221041505_create_cats_core_lost_commodities.rb
396
400
  - lib/cats/core.rb
397
401
  - lib/cats/core/engine.rb
398
402
  - lib/cats/core/version.rb
@@ -415,6 +419,7 @@ files:
415
419
  - spec/factories/cats/core/gift_certificates.rb
416
420
  - spec/factories/cats/core/hub_authorizations.rb
417
421
  - spec/factories/cats/core/locations.rb
422
+ - spec/factories/cats/core/lost_commodities.rb
418
423
  - spec/factories/cats/core/menu_items.rb
419
424
  - spec/factories/cats/core/menus.rb
420
425
  - spec/factories/cats/core/monthly_plan_item_details.rb