cats_core 1.2.16 → 1.2.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/cats/core/routes_controller.rb +13 -0
  3. data/app/models/cats/core/contract_item.rb +13 -0
  4. data/app/models/cats/core/donation.rb +2 -2
  5. data/app/models/cats/core/{hrp.rb → plan.rb} +2 -2
  6. data/app/models/cats/core/{hrp_item.rb → plan_item.rb} +4 -4
  7. data/app/models/cats/core/{hrp_item_detail.rb → plan_item_detail.rb} +3 -3
  8. data/app/models/cats/core/route.rb +18 -0
  9. data/app/models/cats/core/transport_bid.rb +43 -0
  10. data/app/models/cats/core/transport_bid_item.rb +16 -0
  11. data/app/models/cats/core/transport_contract.rb +10 -0
  12. data/app/models/cats/core/transport_offer.rb +1 -1
  13. data/app/serializers/cats/core/route_serializer.rb +7 -0
  14. data/config/routes.rb +1 -0
  15. data/db/migrate/{20210717031810_create_cats_core_hrps.rb → 20210717031810_create_cats_core_plans.rb} +4 -4
  16. data/db/migrate/20210717032024_create_cats_core_plan_items.rb +23 -0
  17. data/db/migrate/20210717032240_create_cats_core_plan_item_details.rb +18 -0
  18. data/db/migrate/20210717032330_create_cats_core_donations.rb +3 -3
  19. data/db/migrate/20210718040129_create_cats_core_routes.rb +19 -0
  20. data/db/migrate/20211215121151_create_cats_core_transport_bids.rb +13 -0
  21. data/db/migrate/20211215124452_create_cats_core_transport_bid_items.rb +21 -0
  22. data/db/migrate/{20211209160126_create_cats_core_transport_offers.rb → 20211229160126_create_cats_core_transport_offers.rb} +3 -3
  23. data/db/migrate/20211229160127_create_cats_core_transport_contracts.rb +19 -0
  24. data/db/migrate/20211229160128_create_cats_core_contract_items.rb +21 -0
  25. data/lib/cats/core/version.rb +1 -1
  26. data/spec/factories/cats/core/contract_items.rb +8 -0
  27. data/spec/factories/cats/core/donations.rb +1 -1
  28. data/spec/factories/cats/core/plan_item_details.rb +7 -0
  29. data/spec/factories/cats/core/{hrp_items.rb → plan_items.rb} +2 -2
  30. data/spec/factories/cats/core/plans.rb +10 -0
  31. data/spec/factories/cats/core/routes.rb +6 -0
  32. data/spec/factories/cats/core/transport_bid_items.rb +8 -0
  33. data/spec/factories/cats/core/transport_bids.rb +8 -0
  34. data/spec/factories/cats/core/transport_contracts.rb +9 -0
  35. data/spec/factories/cats/core/transport_offers.rb +1 -1
  36. metadata +29 -16
  37. data/db/migrate/20210717032024_create_cats_core_hrp_items.rb +0 -23
  38. data/db/migrate/20210717032240_create_cats_core_hrp_item_details.rb +0 -18
  39. data/db/migrate/20211209155113_create_cats_core_transport_requests.rb +0 -19
  40. data/db/migrate/20211209155915_create_cats_core_transport_request_items.rb +0 -24
  41. data/spec/factories/cats/core/hrp_item_details.rb +0 -7
  42. data/spec/factories/cats/core/hrps.rb +0 -10
  43. data/spec/factories/cats/core/transport_request_items.rb +0 -8
  44. data/spec/factories/cats/core/transport_requests.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83ed27840275615cce0b4a2fdee9d147a61407eef87df375e9db5e0424d4e923
4
- data.tar.gz: 06a77ee55dec5a1d292afeaa225b35629867d85eac43640d5073aab84b657634
3
+ metadata.gz: 17f638d1558c70663410c90630da5764199dba7c9475162e40ba51ff4eb4e6ab
4
+ data.tar.gz: ecdb4518988dd53281e19c942edb3295bc410e1f10bf6ac765b07e5c05b85c99
5
5
  SHA512:
6
- metadata.gz: f57ac8ebc0d69cb0abc5e0b19a28ae3afd4b3549a72b2fe34469bf63e15bc05067fa101bc378b97f073b5650b66d21516d9ea7998d165e8e5b133d971e08dbfe
7
- data.tar.gz: 41f293dd59320cafef958b1d1dcf6b2342e2af1d696e31fb761ff50cf749966e5a993062d23f3e859c32bbb0431cba93c333b7410977be67a33c1bb8575e829a
6
+ metadata.gz: d618acb0e39c3ee0932b25a8e5b2f41dded24cad7867b35a86d1062f70f3d4de857865c1e38f8da3c903b3c26e9d3b19264a717cdc29eecdbf3e34acda967566
7
+ data.tar.gz: 3730419db5c67164ad6a7809e10bbce30a1b4f9a83f8639371f5e5f6758f628d346291a1072e613e43d3ace9838aed73a96eec441ded96ad5b29a7216b9f8544
@@ -0,0 +1,13 @@
1
+ module Cats
2
+ module Core
3
+ class RoutesController < ApplicationController
4
+ include Common
5
+
6
+ private
7
+
8
+ def model_params
9
+ params.require(:payload).permit(:source_id, :destination_id)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module Cats
2
+ module Core
3
+ class ContractItem < ApplicationRecord
4
+ belongs_to :transport_contract
5
+ belongs_to :route
6
+ belongs_to :unit, class_name: 'Cats::Core::UnitOfMeasure'
7
+
8
+ validates :price, presence: true, numericality: { greater_than: 0 }
9
+
10
+ delegate(:name, to: :route, prefix: true)
11
+ end
12
+ end
13
+ end
@@ -6,7 +6,7 @@ module Cats
6
6
  DONATION_TYPES = [CASH, KIND].freeze
7
7
 
8
8
  belongs_to :donor
9
- belongs_to :hrp
9
+ belongs_to :plan
10
10
  belongs_to :currency, optional: true
11
11
  belongs_to :commodity_category, optional: true
12
12
  belongs_to :unit_of_measure, optional: true
@@ -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: :hrp, prefix: true)
22
+ delegate(:reference_no, to: :plan, prefix: 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)
@@ -1,6 +1,6 @@
1
1
  module Cats
2
2
  module Core
3
- class Hrp < ApplicationRecord
3
+ class Plan < ApplicationRecord
4
4
  DRAFT = 'Draft'.freeze
5
5
  APPROVED = 'Approved'.freeze
6
6
  NEEDS_APPROVED = 'Needs Approved'.freeze
@@ -13,7 +13,7 @@ module Cats
13
13
 
14
14
  belongs_to :program
15
15
  belongs_to :ration, optional: true
16
- has_many :hrp_items
16
+ has_many :plan_items
17
17
 
18
18
  validates :reference_no, :year, :status, presence: true
19
19
  validates :season, presence: true, inclusion: { in: SEASONS }
@@ -1,14 +1,14 @@
1
1
  module Cats
2
2
  module Core
3
- class HrpItem < ApplicationRecord
4
- belongs_to :hrp
3
+ class PlanItem < ApplicationRecord
4
+ belongs_to :plan
5
5
  belongs_to :woreda, -> { where(location_type: Cats::Core::Location::WOREDA) }, class_name: 'Cats::Core::Location'
6
6
  belongs_to :operator
7
7
 
8
- has_many :hrp_item_details
8
+ has_many :plan_item_details
9
9
 
10
10
  validates :beneficiaries, presence: true, numericality: { greater_than: 0 }
11
- validates :hrp_id, uniqueness: { scope: :woreda_id }
11
+ validates :plan_id, uniqueness: { scope: :woreda_id }
12
12
 
13
13
  delegate(:name, to: :woreda, prefix: true)
14
14
  delegate(:name, to: :operator, prefix: true)
@@ -1,11 +1,11 @@
1
1
  module Cats
2
2
  module Core
3
- class HrpItemDetail < ApplicationRecord
4
- belongs_to :hrp_item
3
+ class PlanItemDetail < ApplicationRecord
4
+ belongs_to :plan_item
5
5
  belongs_to :ration_item
6
6
 
7
7
  validates :amount, presence: true, numericality: { greater_than: 0 }
8
- validates :hrp_item_id, uniqueness: { scope: :ration_item_id }
8
+ validates :plan_item_id, uniqueness: { scope: :ration_item_id }
9
9
  end
10
10
  end
11
11
  end
@@ -0,0 +1,18 @@
1
+ module Cats
2
+ module Core
3
+ class Route < ApplicationRecord
4
+ before_validation :set_name, on: %i[create update]
5
+
6
+ belongs_to :source, class_name: 'Cats::Core::Location'
7
+ belongs_to :destination, class_name: 'Cats::Core::Location'
8
+
9
+ validates :source_id, uniqueness: { scope: :destination_id }
10
+
11
+ def set_name
12
+ return unless source && destination
13
+
14
+ self.name = "#{source.name} - #{destination.name}"
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,43 @@
1
+ module Cats
2
+ module Core
3
+ class TransportBid < ApplicationRecord
4
+ NEW = 'New'.freeze
5
+ OPEN = 'Open'.freeze
6
+ CLOSED = 'Closed'.freeze
7
+ STATUSES = [NEW, OPEN, CLOSED].freeze
8
+
9
+ has_many :transport_bid_items
10
+
11
+ validates :reference_no, presence: true, uniqueness: true
12
+ validates :start_date, :end_date, :status, presence: true
13
+ validates :status, inclusion: { in: STATUSES }
14
+ validate :validate_start_date_against_end_date
15
+
16
+ def validate_start_date_against_end_date
17
+ return unless start_date && end_date
18
+
19
+ errors.add(:start_date, 'should be before end date.') if start_date >= end_date
20
+ end
21
+
22
+ def open
23
+ raise(StandardError, 'Bid is already open.') if status == OPEN
24
+
25
+ raise(StandardError, 'Bid is empty.') if transport_bid_items.count.zero?
26
+
27
+ self.status = OPEN
28
+ save!
29
+ self
30
+ end
31
+
32
+ def close
33
+ raise(StandardError, 'Bid is already closed.') if status == CLOSED
34
+
35
+ raise(StandardError, 'Bid should first be open.') if status == NEW
36
+
37
+ self.status = CLOSED
38
+ save!
39
+ self
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,16 @@
1
+ module Cats
2
+ module Core
3
+ class TransportBidItem < ApplicationRecord
4
+ belongs_to :transport_bid
5
+ belongs_to :route
6
+ belongs_to :unit, class_name: 'Cats::Core::UnitOfMeasure', optional: true
7
+
8
+ has_many :transport_offers
9
+
10
+ validates :quantity, presence: true, numericality: { greater_than: 0 }
11
+
12
+ delegate(:name, to: :route, prefix: true)
13
+ delegate(:name, to: :unit, prefix: true, allow_nil: true)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,10 @@
1
+ module Cats
2
+ module Core
3
+ class TransportContract < ApplicationRecord
4
+ belongs_to :region, class_name: 'Cats::Core::Location'
5
+ belongs_to :transporter
6
+
7
+ validates :contract_date, :expires_on, presence: true
8
+ end
9
+ end
10
+ end
@@ -1,7 +1,7 @@
1
1
  module Cats
2
2
  module Core
3
3
  class TransportOffer < ApplicationRecord
4
- belongs_to :transport_request_item
4
+ belongs_to :transport_bid_item
5
5
  belongs_to :transporter
6
6
 
7
7
  validates :price, presence: true, numericality: { greater_than: 0 }
@@ -0,0 +1,7 @@
1
+ module Cats
2
+ module Core
3
+ class RouteSerializer < ActiveModel::Serializer
4
+ attributes :id, :name, :source_id, :destination_id
5
+ end
6
+ end
7
+ end
data/config/routes.rb CHANGED
@@ -66,6 +66,7 @@ Cats::Core::Engine.routes.draw do
66
66
  end
67
67
  resources :currencies, except: %i[destroy]
68
68
  resources :unit_of_measures, except: %i[destroy]
69
+ resources :routes, except: %i[destroy]
69
70
 
70
71
  post '/dispatch_plans/filter', controller: :dispatch_plans, action: :filter
71
72
  resources :dispatch_plans do
@@ -1,6 +1,6 @@
1
- class CreateCatsCoreHrps < ActiveRecord::Migration[6.1]
1
+ class CreateCatsCorePlans < ActiveRecord::Migration[6.1]
2
2
  def change
3
- create_table :cats_core_hrps do |t|
3
+ create_table :cats_core_plans do |t|
4
4
  t.string :reference_no, unique: true
5
5
  t.integer :year, null: false
6
6
  t.string :season, null: false
@@ -8,11 +8,11 @@ class CreateCatsCoreHrps < ActiveRecord::Migration[6.1]
8
8
 
9
9
  t.references :program,
10
10
  null: false,
11
- index: { name: 'program_on_hrp_indx' },
11
+ index: { name: 'program_on_plan_indx' },
12
12
  foreign_key: { to_table: :cats_core_programs }
13
13
  t.references :ration,
14
14
  null: true,
15
- index: { name: 'ration_on_hrp_indx' },
15
+ index: { name: 'ration_on_plan_indx' },
16
16
  foreign_key: { to_table: :cats_core_rations }
17
17
 
18
18
  t.timestamps
@@ -0,0 +1,23 @@
1
+ class CreateCatsCorePlanItems < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_plan_items do |t|
4
+ t.references :plan,
5
+ null: false,
6
+ index: { name: 'plan_on_plan_items_indx' },
7
+ foreign_key: { to_table: :cats_core_plans }
8
+ t.references :woreda,
9
+ null: false,
10
+ index: { name: 'woreda_on_plan_items_idnx' },
11
+ foreign_key: { to_table: :cats_core_locations }
12
+ t.integer :beneficiaries, null: false
13
+ t.references :operator,
14
+ null: false,
15
+ index: { name: 'operator_on_plan_items_indx' },
16
+ foreign_key: { to_table: :cats_core_operators }
17
+
18
+ t.timestamps
19
+ end
20
+
21
+ add_index :cats_core_plan_items, [:plan_id, :woreda_id], unique: true
22
+ end
23
+ end
@@ -0,0 +1,18 @@
1
+ class CreateCatsCorePlanItemDetails < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_plan_item_details do |t|
4
+ t.references :plan_item,
5
+ null: false,
6
+ index: { name: 'pi_on_pid_indx' },
7
+ foreign_key: { to_table: :cats_core_plan_items }
8
+ t.references :ration_item,
9
+ null: false,
10
+ index: { name: 'ri_on_pid_indx' },
11
+ foreign_key: { to_table: :cats_core_ration_items }
12
+ t.float :amount, null: false
13
+
14
+ t.timestamps
15
+ end
16
+ add_index(:cats_core_plan_item_details, [:plan_item_id, :ration_item_id], unique: true, name: 'pii_rii_on_pid_indx')
17
+ end
18
+ end
@@ -8,10 +8,10 @@ class CreateCatsCoreDonations < ActiveRecord::Migration[6.1]
8
8
  null: false,
9
9
  index: { name: 'donor_on_donation_indx' },
10
10
  foreign_key: { to_table: :cats_core_donors }
11
- t.references :hrp,
11
+ t.references :plan,
12
12
  null: false,
13
- index: { name: 'hrp_on_donation_indx' },
14
- foreign_key: { to_table: :cats_core_hrps }
13
+ index: { name: 'plan_on_donation_indx' },
14
+ foreign_key: { to_table: :cats_core_plans }
15
15
  t.float :amount, null: false
16
16
  t.references :currency,
17
17
  null: true,
@@ -0,0 +1,19 @@
1
+ class CreateCatsCoreRoutes < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_routes do |t|
4
+ t.string :name, null: false
5
+ t.references :source,
6
+ null: false,
7
+ index: { name: 'source_on_routes_indx' },
8
+ foreign_key: { to_table: :cats_core_locations }
9
+ t.references :destination,
10
+ null: false,
11
+ index: { name: 'destination_on_routes_indx' },
12
+ foreign_key: { to_table: :cats_core_locations }
13
+
14
+ t.timestamps
15
+
16
+ t.index [:source_id, :destination_id], unique: true
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ class CreateCatsCoreTransportBids < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_transport_bids do |t|
4
+ t.string :reference_no, unique: true
5
+ t.string :description
6
+ t.date :start_date, null: false
7
+ t.date :end_date, null: false
8
+ t.string :status, null: false, default: 'New'
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ class CreateCatsCoreTransportBidItems < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_transport_bid_items do |t|
4
+ t.references :transport_bid,
5
+ null: false,
6
+ index: { name: 'tb_on_tbi_indx' },
7
+ foreign_key: { to_table: :cats_core_transport_bids }
8
+ t.references :route,
9
+ null: false,
10
+ index: { name: 'route_on_tbi_indx' },
11
+ foreign_key: { to_table: :cats_core_routes }
12
+ t.references :unit,
13
+ null: true,
14
+ index: { name: 'unit_on_tbi_indx' },
15
+ foreign_key: { to_table: :cats_core_unit_of_measures }
16
+ t.float :quantity, null: false
17
+
18
+ t.timestamps
19
+ end
20
+ end
21
+ end
@@ -1,10 +1,10 @@
1
1
  class CreateCatsCoreTransportOffers < ActiveRecord::Migration[6.1]
2
2
  def change
3
3
  create_table :cats_core_transport_offers do |t|
4
- t.references :transport_request_item,
4
+ t.references :transport_bid_item,
5
5
  null: false,
6
- index: { name: 'to_on_tri_indx' },
7
- foreign_key: { to_table: :cats_core_transport_request_items }
6
+ index: { name: 'to_on_tbi_indx' },
7
+ foreign_key: { to_table: :cats_core_transport_bid_items }
8
8
  t.references :transporter,
9
9
  null: false,
10
10
  index: { name: 'to_on_transporter_indx' },
@@ -0,0 +1,19 @@
1
+ class CreateCatsCoreTransportContracts < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_transport_contracts do |t|
4
+ t.references :region,
5
+ null: false,
6
+ index: { name: 'region_on_tc_indx' },
7
+ foreign_key: { to_table: :cats_core_locations }
8
+ t.references :transporter,
9
+ null: false,
10
+ index: { name: 'transporter_on_tc_indx' },
11
+ foreign_key: { to_table: :cats_core_transporters }
12
+ t.date :contract_date, null: false
13
+ t.date :expires_on, null: false
14
+ t.string :payment_term
15
+
16
+ t.timestamps
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,21 @@
1
+ class CreateCatsCoreContractItems < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_contract_items do |t|
4
+ t.references :transport_contract,
5
+ null: false,
6
+ index: { name: 'tc_on_ci_indx' },
7
+ foreign_key: { to_table: :cats_core_transport_contracts }
8
+ t.references :route,
9
+ null: false,
10
+ index: { name: 'route_on_ci_indx' },
11
+ foreign_key: { to_table: :cats_core_routes }
12
+ t.float :price, null: false
13
+ t.references :unit,
14
+ null: false,
15
+ index: { name: 'unit_on_ci_indx' },
16
+ foreign_key: { to_table: :cats_core_unit_of_measures }
17
+
18
+ t.timestamps
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.2.16'.freeze
3
+ VERSION = '1.2.20'.freeze
4
4
  end
5
5
  end
@@ -0,0 +1,8 @@
1
+ FactoryBot.define do
2
+ factory :contract_item, class: 'Cats::Core::ContractItem' do
3
+ transport_contract
4
+ route
5
+ price { 150 }
6
+ unit factory: :unit_of_measure
7
+ end
8
+ end
@@ -4,7 +4,7 @@ FactoryBot.define do
4
4
  donation_type { Cats::Core::Donation::KIND }
5
5
  donated_on { Date.today }
6
6
  donor
7
- hrp
7
+ plan
8
8
  amount { 100 }
9
9
  currency { nil }
10
10
  commodity_category
@@ -0,0 +1,7 @@
1
+ FactoryBot.define do
2
+ factory :plan_item_detail, class: 'Cats::Core::PlanItemDetail' do
3
+ plan_item
4
+ ration_item
5
+ amount { 150 }
6
+ end
7
+ end
@@ -1,6 +1,6 @@
1
1
  FactoryBot.define do
2
- factory :hrp_item, class: 'Cats::Core::HrpItem' do
3
- hrp
2
+ factory :plan_item, class: 'Cats::Core::PlanItem' do
3
+ plan
4
4
  woreda
5
5
  beneficiaries { 100 }
6
6
  operator
@@ -0,0 +1,10 @@
1
+ FactoryBot.define do
2
+ factory :plan, class: 'Cats::Core::Plan' do
3
+ reference_no { FFaker::Name.name }
4
+ year { 1 }
5
+ season { Cats::Core::Plan::BELG }
6
+ status { Cats::Core::Plan::DRAFT }
7
+ program
8
+ ration
9
+ end
10
+ end
@@ -0,0 +1,6 @@
1
+ FactoryBot.define do
2
+ factory :route, class: 'Cats::Core::Route' do
3
+ source factory: :location
4
+ destination factory: :location
5
+ end
6
+ end
@@ -0,0 +1,8 @@
1
+ FactoryBot.define do
2
+ factory :transport_bid_item, class: 'Cats::Core::TransportBidItem' do
3
+ transport_bid
4
+ route
5
+ unit factory: :unit_of_measure
6
+ quantity { 100 }
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ FactoryBot.define do
2
+ factory :transport_bid, class: 'Cats::Core::TransportBid' do
3
+ reference_no { FFaker::Name.name }
4
+ description { FFaker::Name.name }
5
+ start_date { Date.today - 1.week }
6
+ end_date { Date.today }
7
+ end
8
+ end
@@ -0,0 +1,9 @@
1
+ FactoryBot.define do
2
+ factory :transport_contract, class: 'Cats::Core::TransportContract' do
3
+ region factory: :location
4
+ transporter
5
+ contract_date { Date.today }
6
+ expires_on { Date.today + 6.month }
7
+ payment_term { FFaker::Name.name }
8
+ end
9
+ end
@@ -1,6 +1,6 @@
1
1
  FactoryBot.define do
2
2
  factory :transport_offer, class: 'Cats::Core::TransportOffer' do
3
- transport_request_item
3
+ transport_bid_item
4
4
  transporter
5
5
  price { 100 }
6
6
  winner { false }
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.2.16
4
+ version: 1.2.20
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-12-14 00:00:00.000000000 Z
11
+ date: 2021-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -244,6 +244,7 @@ files:
244
244
  - app/controllers/cats/core/receipt_transactions_controller.rb
245
245
  - app/controllers/cats/core/receipts_controller.rb
246
246
  - app/controllers/cats/core/roles_controller.rb
247
+ - app/controllers/cats/core/routes_controller.rb
247
248
  - app/controllers/cats/core/spaces_controller.rb
248
249
  - app/controllers/cats/core/unit_of_measures_controller.rb
249
250
  - app/controllers/cats/core/users_controller.rb
@@ -255,6 +256,7 @@ files:
255
256
  - app/models/cats/core/application_record.rb
256
257
  - app/models/cats/core/commodity.rb
257
258
  - app/models/cats/core/commodity_category.rb
259
+ - app/models/cats/core/contract_item.rb
258
260
  - app/models/cats/core/currency.rb
259
261
  - app/models/cats/core/dispatch.rb
260
262
  - app/models/cats/core/dispatch_plan.rb
@@ -263,15 +265,15 @@ files:
263
265
  - app/models/cats/core/donation.rb
264
266
  - app/models/cats/core/donor.rb
265
267
  - app/models/cats/core/gift_certificate.rb
266
- - app/models/cats/core/hrp.rb
267
- - app/models/cats/core/hrp_item.rb
268
- - app/models/cats/core/hrp_item_detail.rb
269
268
  - app/models/cats/core/location.rb
270
269
  - app/models/cats/core/menu.rb
271
270
  - app/models/cats/core/menu_item.rb
272
271
  - app/models/cats/core/notification.rb
273
272
  - app/models/cats/core/notification_rule.rb
274
273
  - app/models/cats/core/operator.rb
274
+ - app/models/cats/core/plan.rb
275
+ - app/models/cats/core/plan_item.rb
276
+ - app/models/cats/core/plan_item_detail.rb
275
277
  - app/models/cats/core/program.rb
276
278
  - app/models/cats/core/purchase_order.rb
277
279
  - app/models/cats/core/ration.rb
@@ -281,12 +283,16 @@ files:
281
283
  - app/models/cats/core/rhn_request.rb
282
284
  - app/models/cats/core/role.rb
283
285
  - app/models/cats/core/role_menu.rb
286
+ - app/models/cats/core/route.rb
284
287
  - app/models/cats/core/stack.rb
285
288
  - app/models/cats/core/stack_transaction.rb
286
289
  - app/models/cats/core/stacking_rule.rb
287
290
  - app/models/cats/core/store.rb
288
291
  - app/models/cats/core/supplier.rb
289
292
  - app/models/cats/core/transaction.rb
293
+ - app/models/cats/core/transport_bid.rb
294
+ - app/models/cats/core/transport_bid_item.rb
295
+ - app/models/cats/core/transport_contract.rb
290
296
  - app/models/cats/core/transport_offer.rb
291
297
  - app/models/cats/core/transport_request.rb
292
298
  - app/models/cats/core/transport_request_item.rb
@@ -308,6 +314,7 @@ files:
308
314
  - app/serializers/cats/core/receipt_transaction_serializer.rb
309
315
  - app/serializers/cats/core/role_menu_serializer.rb
310
316
  - app/serializers/cats/core/role_serializer.rb
317
+ - app/serializers/cats/core/route_serializer.rb
311
318
  - app/serializers/cats/core/unit_of_measure_serializer.rb
312
319
  - app/serializers/cats/core/user_serializer.rb
313
320
  - app/services/cats/core/dispatch_plan_service.rb
@@ -334,15 +341,16 @@ files:
334
341
  - db/migrate/20210717031108_create_cats_core_donors.rb
335
342
  - db/migrate/20210717031216_create_cats_core_rations.rb
336
343
  - db/migrate/20210717031343_create_cats_core_ration_items.rb
337
- - db/migrate/20210717031810_create_cats_core_hrps.rb
338
- - db/migrate/20210717032024_create_cats_core_hrp_items.rb
339
- - db/migrate/20210717032240_create_cats_core_hrp_item_details.rb
344
+ - db/migrate/20210717031810_create_cats_core_plans.rb
345
+ - db/migrate/20210717032024_create_cats_core_plan_items.rb
346
+ - db/migrate/20210717032240_create_cats_core_plan_item_details.rb
340
347
  - db/migrate/20210717032330_create_cats_core_donations.rb
341
348
  - db/migrate/20210717032602_create_cats_core_gift_certificates.rb
342
349
  - db/migrate/20210717032855_create_cats_core_purchase_orders.rb
343
350
  - db/migrate/20210717033223_create_cats_core_commodities.rb
344
351
  - db/migrate/20210717140855_create_cats_core_stores.rb
345
352
  - db/migrate/20210717171101_create_cats_core_stacks.rb
353
+ - db/migrate/20210718040129_create_cats_core_routes.rb
346
354
  - db/migrate/20210718042749_create_cats_core_transporters.rb
347
355
  - db/migrate/20210718042755_create_cats_core_rhn_requests.rb
348
356
  - db/migrate/20210718042823_create_cats_core_allocations.rb
@@ -359,9 +367,11 @@ files:
359
367
  - db/migrate/20211002050739_create_cats_core_notification_rules.rb
360
368
  - db/migrate/20211024063240_add_status_to_cats_core_rhn_requests.rb
361
369
  - db/migrate/20211030133752_add_status_to_cats_core_commodities.rb
362
- - db/migrate/20211209155113_create_cats_core_transport_requests.rb
363
- - db/migrate/20211209155915_create_cats_core_transport_request_items.rb
364
- - db/migrate/20211209160126_create_cats_core_transport_offers.rb
370
+ - db/migrate/20211215121151_create_cats_core_transport_bids.rb
371
+ - db/migrate/20211215124452_create_cats_core_transport_bid_items.rb
372
+ - db/migrate/20211229160126_create_cats_core_transport_offers.rb
373
+ - db/migrate/20211229160127_create_cats_core_transport_contracts.rb
374
+ - db/migrate/20211229160128_create_cats_core_contract_items.rb
365
375
  - lib/cats/core.rb
366
376
  - lib/cats/core/engine.rb
367
377
  - lib/cats/core/version.rb
@@ -372,6 +382,7 @@ files:
372
382
  - spec/factories/cats/core/application_modules.rb
373
383
  - spec/factories/cats/core/commodities.rb
374
384
  - spec/factories/cats/core/commodity_categories.rb
385
+ - spec/factories/cats/core/contract_items.rb
375
386
  - spec/factories/cats/core/currencies.rb
376
387
  - spec/factories/cats/core/dispatch_plan_items.rb
377
388
  - spec/factories/cats/core/dispatch_plans.rb
@@ -380,15 +391,15 @@ files:
380
391
  - spec/factories/cats/core/donations.rb
381
392
  - spec/factories/cats/core/donors.rb
382
393
  - spec/factories/cats/core/gift_certificates.rb
383
- - spec/factories/cats/core/hrp_item_details.rb
384
- - spec/factories/cats/core/hrp_items.rb
385
- - spec/factories/cats/core/hrps.rb
386
394
  - spec/factories/cats/core/locations.rb
387
395
  - spec/factories/cats/core/menu_items.rb
388
396
  - spec/factories/cats/core/menus.rb
389
397
  - spec/factories/cats/core/notification_rules.rb
390
398
  - spec/factories/cats/core/notifications.rb
391
399
  - spec/factories/cats/core/operators.rb
400
+ - spec/factories/cats/core/plan_item_details.rb
401
+ - spec/factories/cats/core/plan_items.rb
402
+ - spec/factories/cats/core/plans.rb
392
403
  - spec/factories/cats/core/programs.rb
393
404
  - spec/factories/cats/core/purchase_orders.rb
394
405
  - spec/factories/cats/core/ration_items.rb
@@ -398,14 +409,16 @@ files:
398
409
  - spec/factories/cats/core/rhn_requests.rb
399
410
  - spec/factories/cats/core/role_menus.rb
400
411
  - spec/factories/cats/core/roles.rb
412
+ - spec/factories/cats/core/routes.rb
401
413
  - spec/factories/cats/core/stack_transactions.rb
402
414
  - spec/factories/cats/core/stacking_rules.rb
403
415
  - spec/factories/cats/core/stacks.rb
404
416
  - spec/factories/cats/core/stores.rb
405
417
  - spec/factories/cats/core/suppliers.rb
418
+ - spec/factories/cats/core/transport_bid_items.rb
419
+ - spec/factories/cats/core/transport_bids.rb
420
+ - spec/factories/cats/core/transport_contracts.rb
406
421
  - spec/factories/cats/core/transport_offers.rb
407
- - spec/factories/cats/core/transport_request_items.rb
408
- - spec/factories/cats/core/transport_requests.rb
409
422
  - spec/factories/cats/core/transporters.rb
410
423
  - spec/factories/cats/core/unit_of_measures.rb
411
424
  - spec/factories/cats/core/users.rb
@@ -1,23 +0,0 @@
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.references :operator,
14
- null: false,
15
- index: { name: 'operator_on_hrp_items_indx' },
16
- foreign_key: { to_table: :cats_core_operators }
17
-
18
- t.timestamps
19
- end
20
-
21
- add_index :cats_core_hrp_items, [:hrp_id, :woreda_id], unique: true
22
- end
23
- end
@@ -1,18 +0,0 @@
1
- class CreateCatsCoreHrpItemDetails < ActiveRecord::Migration[6.1]
2
- def change
3
- create_table :cats_core_hrp_item_details do |t|
4
- t.references :hrp_item,
5
- null: false,
6
- index: { name: 'hi_on_hid_indx' },
7
- foreign_key: { to_table: :cats_core_hrp_items }
8
- t.references :ration_item,
9
- null: false,
10
- index: { name: 'ri_on_hid_indx' },
11
- foreign_key: { to_table: :cats_core_ration_items }
12
- t.float :amount, null: false
13
-
14
- t.timestamps
15
- end
16
- add_index(:cats_core_hrp_item_details, [:hrp_item_id, :ration_item_id], unique: true, name: 'hii_rii_on_hid_indx')
17
- end
18
- end
@@ -1,19 +0,0 @@
1
- class CreateCatsCoreTransportRequests < ActiveRecord::Migration[6.1]
2
- def change
3
- create_table :cats_core_transport_requests do |t|
4
- t.string :reference_no, unique: true
5
- t.date :request_date, null: false
6
- t.string :status, null: false, default: 'Draft'
7
- t.references :requested_by,
8
- null: false,
9
- index: { name: 'tsr_on_rb_indx' },
10
- foreign_key: { to_table: :cats_core_users }
11
- t.references :approved_by,
12
- null: true,
13
- index: { name: 'tsr_on_ab_indx' },
14
- foreign_key: { to_table: :cats_core_users }
15
-
16
- t.timestamps
17
- end
18
- end
19
- end
@@ -1,24 +0,0 @@
1
- class CreateCatsCoreTransportRequestItems < ActiveRecord::Migration[6.1]
2
- def change
3
- create_table :cats_core_transport_request_items do |t|
4
- t.references :transport_request,
5
- null: false,
6
- index: { name: 'tri_on_tr_indx' },
7
- foreign_key: { to_table: :cats_core_transport_requests }
8
- t.references :source,
9
- null: false,
10
- index: { name: 'tri_on_source_indx' },
11
- foreign_key: { to_table: :cats_core_locations }
12
- t.references :destination,
13
- null: false,
14
- index: { name: 'tri_on_destination_indx'},
15
- foreign_key: { to_table: :cats_core_locations }
16
- t.references :commodity,
17
- null: false,
18
- index: { name: 'tri_on_commodity_indx' },
19
- foreign_key: { to_table: :cats_core_commodities }
20
-
21
- t.timestamps
22
- end
23
- end
24
- end
@@ -1,7 +0,0 @@
1
- FactoryBot.define do
2
- factory :hrp_item_detail, class: 'Cats::Core::HrpItemDetail' do
3
- hrp_item
4
- ration_item
5
- amount { 150 }
6
- end
7
- end
@@ -1,10 +0,0 @@
1
- FactoryBot.define do
2
- factory :hrp, class: 'Cats::Core::Hrp' do
3
- reference_no { FFaker::Name.name }
4
- year { 1 }
5
- season { Cats::Core::Hrp::BELG }
6
- status { Cats::Core::Hrp::DRAFT }
7
- program
8
- ration
9
- end
10
- end
@@ -1,8 +0,0 @@
1
- FactoryBot.define do
2
- factory :transport_request_item, class: 'Cats::Core::TransportRequestItem' do
3
- transport_request
4
- source factory: :location
5
- destination factory: :location
6
- commodity
7
- end
8
- end
@@ -1,8 +0,0 @@
1
- FactoryBot.define do
2
- factory :transport_request, class: 'Cats::Core::TransportRequest' do
3
- reference_no { FFaker::Name.name }
4
- request_date { Date.today }
5
- requested_by factory: :user
6
- approved_by factory: :user
7
- end
8
- end