cats_core 1.0.12 → 1.0.16

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.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/cats/core/commodity.rb +2 -3
  3. data/app/models/cats/core/commodity_allocation.rb +19 -0
  4. data/app/models/cats/core/currency.rb +8 -0
  5. data/app/models/cats/core/dispatch.rb +14 -0
  6. data/app/models/cats/core/dispatch_transaction.rb +8 -0
  7. data/app/models/cats/core/donation.rb +18 -0
  8. data/app/models/cats/core/gift_certificate.rb +11 -0
  9. data/app/models/cats/core/hrp.rb +16 -0
  10. data/app/models/cats/core/hrp_item.rb +12 -0
  11. data/app/models/cats/core/operator.rb +8 -0
  12. data/app/models/cats/core/purchase_order.rb +11 -0
  13. data/app/models/cats/core/ration.rb +12 -0
  14. data/app/models/cats/core/receipt.rb +19 -0
  15. data/app/models/cats/core/receipt_transaction.rb +8 -0
  16. data/app/models/cats/core/stack.rb +2 -2
  17. data/app/models/cats/core/stack_transaction.rb +8 -0
  18. data/app/models/cats/core/store.rb +26 -2
  19. data/app/models/cats/core/supplier.rb +8 -0
  20. data/app/models/cats/core/transaction.rb +32 -0
  21. data/app/models/cats/core/user.rb +13 -1
  22. data/app/services/cats/core/notification_service.rb +3 -6
  23. data/db/migrate/20210715114910_create_cats_core_users.rb +1 -0
  24. data/db/migrate/{20210717043620_create_cats_core_locations.rb → 20210716183620_create_cats_core_locations.rb} +0 -0
  25. data/db/migrate/20210716185529_create_cats_core_currencies.rb +10 -0
  26. data/db/migrate/20210716210635_create_cats_core_operators.rb +13 -0
  27. data/db/migrate/20210716210905_create_cats_core_suppliers.rb +14 -0
  28. data/db/migrate/20210717031216_create_cats_core_rations.rb +19 -0
  29. data/db/migrate/20210717031810_create_cats_core_hrps.rb +20 -0
  30. data/db/migrate/20210717032024_create_cats_core_hrp_items.rb +22 -0
  31. data/db/migrate/20210717032330_create_cats_core_donations.rb +24 -0
  32. data/db/migrate/20210717032602_create_cats_core_gift_certificates.rb +29 -0
  33. data/db/migrate/20210717032855_create_cats_core_purchase_orders.rb +21 -0
  34. data/db/migrate/20210717033223_create_cats_core_commodities.rb +2 -14
  35. data/db/migrate/20210717140855_create_cats_core_stores.rb +4 -3
  36. data/db/migrate/20210718042823_create_cats_core_commodity_allocations.rb +23 -0
  37. data/db/migrate/20210718045516_create_cats_core_dispatches.rb +27 -0
  38. data/db/migrate/20210718202957_create_cats_core_dispatch_transactions.rb +19 -0
  39. data/db/migrate/20210727074646_create_cats_core_receipts.rb +20 -0
  40. data/db/migrate/20210814160628_create_cats_core_receipt_transactions.rb +19 -0
  41. data/db/migrate/20210814175406_create_cats_core_stack_transactions.rb +19 -0
  42. data/lib/cats/core/version.rb +1 -1
  43. data/spec/factories/cats/core/commodities.rb +2 -5
  44. data/spec/factories/cats/core/commodity_allocations.rb +10 -0
  45. data/spec/factories/cats/core/currencies.rb +6 -0
  46. data/spec/factories/cats/core/dispatch_transactions.rb +9 -0
  47. data/spec/factories/cats/core/dispatches.rb +13 -0
  48. data/spec/factories/cats/core/donations.rb +11 -0
  49. data/spec/factories/cats/core/gift_certificates.rb +17 -0
  50. data/spec/factories/cats/core/hrp_items.rb +9 -0
  51. data/spec/factories/cats/core/hrps.rb +10 -0
  52. data/spec/factories/cats/core/locations.rb +5 -0
  53. data/spec/factories/cats/core/operators.rb +9 -0
  54. data/spec/factories/cats/core/purchase_orders.rb +10 -0
  55. data/spec/factories/cats/core/rations.rb +8 -0
  56. data/spec/factories/cats/core/receipt_transactions.rb +9 -0
  57. data/spec/factories/cats/core/receipts.rb +10 -0
  58. data/spec/factories/cats/core/stack_transactions.rb +9 -0
  59. data/spec/factories/cats/core/stores.rb +2 -2
  60. data/spec/factories/cats/core/suppliers.rb +10 -0
  61. data/spec/factories/cats/core/users.rb +1 -0
  62. metadata +49 -15
  63. data/app/models/cats/core/commodity_transaction.rb +0 -55
  64. data/app/models/cats/core/receipt_plan.rb +0 -24
  65. data/app/models/cats/core/way_bill.rb +0 -12
  66. data/app/models/cats/core/way_bill_item.rb +0 -15
  67. data/db/migrate/20210718045516_create_cats_core_way_bills.rb +0 -25
  68. data/db/migrate/20210718050751_create_cats_core_way_bill_items.rb +0 -18
  69. data/db/migrate/20210718202957_create_cats_core_commodity_transactions.rb +0 -14
  70. data/db/migrate/20210727074646_create_cats_core_receipt_plans.rb +0 -16
  71. data/spec/factories/cats/core/commodity_transactions.rb +0 -10
  72. data/spec/factories/cats/core/receipt_plans.rb +0 -9
  73. data/spec/factories/cats/core/way_bill_items.rb +0 -8
  74. data/spec/factories/cats/core/way_bills.rb +0 -12
@@ -0,0 +1,19 @@
1
+ class CreateCatsCoreRations < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_rations do |t|
4
+ t.string :reference_no, unique: true
5
+ t.references :program,
6
+ null: false,
7
+ index: { name: 'program_on_ration_indx' },
8
+ foreign_key: { to_table: :cats_core_programs }
9
+ t.references :commodity_category,
10
+ null: false,
11
+ index: { name: 'cc_on_ration_indx' },
12
+ foreign_key: { to_table: :cats_core_commodity_categories }
13
+ t.float :amount, null: false
14
+ t.boolean :current, null: false, default: true
15
+
16
+ t.timestamps
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,20 @@
1
+ class CreateCatsCoreHrps < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_hrps do |t|
4
+ t.string :reference_no, unique: true
5
+ t.integer :year, null: false
6
+ t.string :season, null: false
7
+ t.string :status, null: false, default: 'Draft'
8
+ t.references :program,
9
+ null: false,
10
+ index: { name: 'program_on_hrp_indx' },
11
+ foreign_key: { to_table: :cats_core_programs }
12
+ t.references :ration,
13
+ null: false,
14
+ index: { name: 'ration_on_hrp_indx' },
15
+ foreign_key: { to_table: :cats_core_rations }
16
+
17
+ t.timestamps
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,22 @@
1
+ class CreateCatsCoreHrpItems < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_hrp_items do |t|
4
+ t.references :hrp,
5
+ null: false,
6
+ index: { name: 'hrp_on_hrp_items_indx' },
7
+ foreign_key: { to_table: :cats_core_hrps }
8
+ t.references :woreda,
9
+ null: false,
10
+ index: { name: 'woreda_on_hrp_items_idnx' },
11
+ foreign_key: { to_table: :cats_core_locations }
12
+ t.integer :beneficiaries, null: false
13
+ t.float :commodity_amount, null: false
14
+ t.references :operator,
15
+ null: false,
16
+ index: { name: 'operator_on_hrp_items_indx' },
17
+ foreign_key: { to_table: :cats_core_operators }
18
+
19
+ t.timestamps
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,24 @@
1
+ class CreateCatsCoreDonations < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_donations do |t|
4
+ t.string :reference_no, unique: true
5
+ t.string :donation_type, null: false
6
+ t.date :donated_on, null: false
7
+ t.references :donor,
8
+ null: false,
9
+ index: { name: 'donor_on_donation_indx' },
10
+ foreign_key: { to_table: :cats_core_donors }
11
+ t.references :hrp,
12
+ null: false,
13
+ index: { name: 'hrp_on_donation_indx' },
14
+ foreign_key: { to_table: :cats_core_hrps }
15
+ t.float :amount
16
+ t.references :currency,
17
+ null: true,
18
+ index: { name: 'currency_on_donation_indx' },
19
+ foreign_key: { to_table: :cats_core_currencies }
20
+
21
+ t.timestamps
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,29 @@
1
+ class CreateCatsCoreGiftCertificates < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_gift_certificates do |t|
4
+ t.string :reference_no, unique: true
5
+ t.date :gift_date, null: false
6
+
7
+ t.references :donation,
8
+ null: false,
9
+ index: { name: 'gc_on_donation_indx' },
10
+ foreign_key: { to_table: :cats_core_donations }
11
+ t.references :commodity_category,
12
+ null: false,
13
+ index: { name: 'gc_on_cc_indx' },
14
+ foreign_key: { to_table: :cats_core_commodity_categories }
15
+
16
+ t.string :vessel
17
+ t.string :port
18
+ t.string :customs_declaration_no
19
+ t.integer :purchase_year
20
+ t.date :expiry_date
21
+ t.string :bill_of_lading_no
22
+ t.float :amount, null: false
23
+ t.float :estimated_price
24
+ t.float :estimated_tax
25
+
26
+ t.timestamps
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,21 @@
1
+ class CreateCatsCorePurchaseOrders < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_purchase_orders do |t|
4
+ t.string :reference_no, unique: true
5
+ t.date :order_date, null: false
6
+ t.string :requisition_no
7
+ t.string :supplier, null: false
8
+
9
+ t.references :donation,
10
+ null: false,
11
+ index: { name: 'po_on_donation_indx' },
12
+ foreign_key: { to_table: :cats_core_donations }
13
+ t.references :commodity_category,
14
+ null: false,
15
+ index: { name: 'po_on_cc_indx' },
16
+ foreign_key: { to_table: :cats_core_commodity_categories }
17
+
18
+ t.timestamps
19
+ end
20
+ end
21
+ end
@@ -1,26 +1,14 @@
1
1
  class CreateCatsCoreCommodities < ActiveRecord::Migration[6.1]
2
2
  def change
3
3
  create_table :cats_core_commodities do |t|
4
- t.references :commodity_category,
5
- null: false,
6
- index: { name: 'cc_on_commodities_indx' },
7
- foreign_key: { to_table: :cats_core_commodity_categories }
8
- t.references :donor,
9
- null: false,
10
- index: { name: 'donor_on_commodities_indx' },
11
- foreign_key: { to_table: :cats_core_donors }
12
- t.references :program,
13
- null: false,
14
- index: { name: 'program_on_commodities_indx' },
15
- foreign_key: { to_table: :cats_core_programs}
16
4
  t.references :unit_of_measure,
17
5
  null: false,
18
6
  index: { name: 'uom_on_commodities_indx' },
19
7
  foreign_key: { to_table: :cats_core_unit_of_measures }
8
+ t.references :source, polymorphic: true
20
9
  t.float :quantity, null: false
21
10
  t.string :description
22
- t.boolean :hazardous, null: false, default: false
23
- t.date :best_use_before
11
+ t.date :best_use_before, null: false
24
12
  t.float :volume_per_metric_ton
25
13
 
26
14
  t.timestamps
@@ -2,8 +2,6 @@ class CreateCatsCoreStores < ActiveRecord::Migration[6.1]
2
2
  def change
3
3
  create_table :cats_core_stores do |t|
4
4
  t.string :name, null: false
5
- t.string :store_keeper_name, null: false
6
- t.string :store_keeper_phone
7
5
  t.float :length, null: false
8
6
  t.float :width, null: false
9
7
  t.float :height, null: false
@@ -16,7 +14,10 @@ class CreateCatsCoreStores < ActiveRecord::Migration[6.1]
16
14
  null: false,
17
15
  index: { name: 'warehouse_on_stores_indx' },
18
16
  foreign_key: { to_table: :cats_core_locations }
19
-
17
+ t.references :store_keeper,
18
+ null: false,
19
+ index: { name: 'store_keeper_on_store_indx' },
20
+ foreign_key: { to_table: :cats_core_users }
20
21
  t.timestamps
21
22
  end
22
23
  end
@@ -0,0 +1,23 @@
1
+ class CreateCatsCoreCommodityAllocations < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_commodity_allocations do |t|
4
+ t.references :commodity,
5
+ null: false,
6
+ index: { name: 'ca_on_commodity_indx' },
7
+ foreign_key: { to_table: :cats_core_commodities }
8
+ t.references :source,
9
+ null: false,
10
+ index: { name: 'ca_on_source_indx' },
11
+ foreign_key: { to_table: :cats_core_locations }
12
+ t.references :destination,
13
+ null: false,
14
+ index: { name: 'ca_on_destination_indx' },
15
+ foreign_key: { to_table: :cats_core_locations }
16
+ t.float :quantity, null: false
17
+ t.string :commodity_status, null: false, default: 'Good'
18
+ t.string :remark
19
+
20
+ t.timestamps
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,27 @@
1
+ class CreateCatsCoreDispatches < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_dispatches do |t|
4
+ t.string :reference_no, unique: true
5
+ t.references :commodity_allocation,
6
+ null: false,
7
+ index: { name: 'ca_on_dispatches_indx' },
8
+ foreign_key: { to_table: :cats_core_commodity_allocations }
9
+ t.references :transporter,
10
+ null: false,
11
+ index: { name: 'transporter_on_dispatches_indx' },
12
+ foreign_key: { to_table: :cats_core_transporters }
13
+ t.string :plate_no, null: false
14
+ t.string :driver_name, null: false
15
+ t.string :driver_phone, null: false
16
+ t.float :quantity, null: false
17
+ t.string :commodity_status, null: false, default: 'Good'
18
+ t.string :remark
19
+ t.references :prepared_by,
20
+ null: false,
21
+ index: { name: 'pb_on_dispatches_indx' },
22
+ foreign_key: { to_table: :cats_core_users }
23
+
24
+ t.timestamps
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,19 @@
1
+ class CreateCatsCoreDispatchTransactions < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_dispatch_transactions do |t|
4
+ t.references :source,
5
+ null: false,
6
+ index: { name: 'stack_on_dt_indx' },
7
+ foreign_key: { to_table: :cats_core_stacks }
8
+ t.references :destination,
9
+ null: false,
10
+ index: { name: 'dispatch_on_dt_indx' },
11
+ foreign_key: { to_table: :cats_core_dispatches }
12
+ t.date :transaction_date, null: false
13
+ t.float :quantity, null: false
14
+ t.string :status, null: false, default: 'Draft'
15
+
16
+ t.timestamps
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,20 @@
1
+ class CreateCatsCoreReceipts < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_receipts do |t|
4
+ t.references :dispatch,
5
+ null: false,
6
+ index: { name: 'dispatch_on_receipts_indx' },
7
+ foreign_key: { to_table: :cats_core_dispatches }
8
+ t.float :quantity, null: false
9
+ t.string :commodity_status, null: false, default: 'Good'
10
+ t.string :status, null: false, default: 'Draft'
11
+ t.string :remark
12
+ t.references :prepared_by,
13
+ null: false,
14
+ index: { name: 'pb_on_receipts_indx' },
15
+ foreign_key: { to_table: :cats_core_users }
16
+
17
+ t.timestamps
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,19 @@
1
+ class CreateCatsCoreReceiptTransactions < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_receipt_transactions do |t|
4
+ t.references :source,
5
+ null: false,
6
+ index: { name: 'receipt_on_rt_indx' },
7
+ foreign_key: { to_table: :cats_core_receipts }
8
+ t.references :destination,
9
+ null: false,
10
+ index: { name: 'stack_on_rt_indx' },
11
+ foreign_key: { to_table: :cats_core_stacks }
12
+ t.date :transaction_date, null: false
13
+ t.float :quantity, null: false
14
+ t.string :status, null: false, default: 'Draft'
15
+
16
+ t.timestamps
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ class CreateCatsCoreStackTransactions < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_stack_transactions do |t|
4
+ t.references :source,
5
+ null: false,
6
+ index: { name: 'source_on_st_indx' },
7
+ foreign_key: { to_table: :cats_core_stacks }
8
+ t.references :destination,
9
+ null: false,
10
+ index: { name: 'destination_on_st_indx' },
11
+ foreign_key: { to_table: :cats_core_stacks }
12
+ t.date :transaction_date, null: false
13
+ t.float :quantity, null: false
14
+ t.string :status, null: false, default: 'Draft'
15
+
16
+ t.timestamps
17
+ end
18
+ end
19
+ end
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.0.12'.freeze
3
+ VERSION = '1.0.16'.freeze
4
4
  end
5
5
  end
@@ -1,12 +1,9 @@
1
1
  FactoryBot.define do
2
2
  factory :commodity, class: 'Cats::Core::Commodity' do
3
- association :commodity_category
4
3
  description { FFaker::Name.name }
5
- association :donor
6
- association :program
7
- association :unit_of_measure
4
+ unit_of_measure
5
+ source factory: :gift_certificate
8
6
  quantity { 100 }
9
- hazardous { false }
10
7
  best_use_before { Date.today + 2.month }
11
8
  volume_per_metric_ton { 10 }
12
9
  end
@@ -0,0 +1,10 @@
1
+ FactoryBot.define do
2
+ factory :commodity_allocation, class: 'Cats::Core::CommodityAllocation' do
3
+ commodity
4
+ source factory: :location
5
+ destination factory: :location
6
+ quantity { 50 }
7
+ commodity_status { Cats::Core::Commodity::GOOD }
8
+ remark { FFaker::Name.name }
9
+ end
10
+ end
@@ -0,0 +1,6 @@
1
+ FactoryBot.define do
2
+ factory :currency, class: 'Cats::Core::Currency' do
3
+ code { FFaker::Name.name }
4
+ name { FFaker::Name.name }
5
+ end
6
+ end
@@ -0,0 +1,9 @@
1
+ FactoryBot.define do
2
+ factory :dispatch_transaction, class: 'Cats::Core::DispatchTransaction' do
3
+ source factory: :stack
4
+ destination factory: :dispatch
5
+ transaction_date { Date.today }
6
+ quantity { 10 }
7
+ status { Cats::Core::Transaction::DRAFT }
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ FactoryBot.define do
2
+ factory :dispatch, class: 'Cats::Core::Dispatch' do
3
+ reference_no { FFaker::Name.name }
4
+ commodity_allocation
5
+ transporter
6
+ plate_no { FFaker::Name.name }
7
+ driver_name { FFaker::Name.name }
8
+ driver_phone { FFaker::Name.name }
9
+ quantity { 50 }
10
+ remark { FFaker::Name.name }
11
+ prepared_by factory: :user
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ FactoryBot.define do
2
+ factory :donation, class: 'Cats::Core::Donation' do
3
+ reference_no { FFaker::Name.name }
4
+ donation_type { Cats::Core::Donation::KIND }
5
+ donated_on { Date.today }
6
+ donor
7
+ hrp
8
+ amount { nil }
9
+ currency { nil }
10
+ end
11
+ end
@@ -0,0 +1,17 @@
1
+ FactoryBot.define do
2
+ factory :gift_certificate, class: 'Cats::Core::GiftCertificate' do
3
+ reference_no { FFaker::Name.name }
4
+ gift_date { Date.today - 1.month }
5
+ donation
6
+ commodity_category
7
+ vessel { FFaker::Name.name }
8
+ port { FFaker::Name.name }
9
+ customs_declaration_no { FFaker::Name.name }
10
+ purchase_year { 1 }
11
+ expiry_date { Date.today + 6.month }
12
+ bill_of_lading_no { FFaker::Name.name }
13
+ amount { 1.5 }
14
+ estimated_price { 1.5 }
15
+ estimated_tax { 1.5 }
16
+ end
17
+ end
@@ -0,0 +1,9 @@
1
+ FactoryBot.define do
2
+ factory :hrp_item, class: 'Cats::Core::HrpItem' do
3
+ hrp
4
+ woreda
5
+ beneficiaries { 100 }
6
+ commodity_amount { 100 }
7
+ operator
8
+ end
9
+ end