cats_core 1.2.14 → 1.2.18

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 (33) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/cats/core/dispatch_plans_controller.rb +15 -0
  3. data/app/controllers/cats/core/routes_controller.rb +13 -0
  4. data/app/models/cats/core/contract_item.rb +13 -0
  5. data/app/models/cats/core/dispatch_plan.rb +3 -0
  6. data/app/models/cats/core/route.rb +18 -0
  7. data/app/models/cats/core/transport_bid.rb +43 -0
  8. data/app/models/cats/core/transport_bid_item.rb +15 -0
  9. data/app/models/cats/core/transport_contract.rb +10 -0
  10. data/app/models/cats/core/transport_offer.rb +5 -5
  11. data/app/models/cats/core/transport_request_item.rb +2 -0
  12. data/app/serializers/cats/core/route_serializer.rb +7 -0
  13. data/config/routes.rb +2 -0
  14. data/db/migrate/20210718040129_create_cats_core_routes.rb +19 -0
  15. data/db/migrate/20210718043328_create_cats_core_dispatch_plans.rb +9 -0
  16. data/db/migrate/20211215121151_create_cats_core_transport_bids.rb +13 -0
  17. data/db/migrate/20211215124452_create_cats_core_transport_bid_items.rb +21 -0
  18. data/db/migrate/{20211209160126_create_cats_core_transport_offers.rb → 20211229160126_create_cats_core_transport_offers.rb} +3 -3
  19. data/db/migrate/20211229160127_create_cats_core_transport_contracts.rb +19 -0
  20. data/db/migrate/20211229160128_create_cats_core_contract_items.rb +21 -0
  21. data/lib/cats/core/version.rb +1 -1
  22. data/spec/factories/cats/core/contract_items.rb +8 -0
  23. data/spec/factories/cats/core/dispatch_plans.rb +2 -0
  24. data/spec/factories/cats/core/routes.rb +6 -0
  25. data/spec/factories/cats/core/transport_bid_items.rb +8 -0
  26. data/spec/factories/cats/core/transport_bids.rb +8 -0
  27. data/spec/factories/cats/core/transport_contracts.rb +9 -0
  28. data/spec/factories/cats/core/transport_offers.rb +1 -1
  29. metadata +20 -7
  30. data/db/migrate/20211209155113_create_cats_core_transport_requests.rb +0 -19
  31. data/db/migrate/20211209155915_create_cats_core_transport_request_items.rb +0 -24
  32. data/spec/factories/cats/core/transport_request_items.rb +0 -8
  33. 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: 7b9dc1890545dec4869aee94fb842abbc54a673f6f84ecc8ef96b927800e70c5
4
- data.tar.gz: 9f0186a8c840f424da193d6c1c9e15bdaec9d1e29a72628094db7de9007c14b2
3
+ metadata.gz: 0b93e9f178cac6984e2689146acb62925c8b1e5aae7ff52af44d1c66c61cbb1f
4
+ data.tar.gz: e86322ba7a49ed5d297d0ee908146c19cdc06379fa3e9378d2453299debe0a68
5
5
  SHA512:
6
- metadata.gz: b82245e6eba1c6ead0156d91fb28273b49747e880b333fbbc04de3e2a9cfb3caa23d3bade2109bb65c01d4c91aaddcb4089623e816e83f4a05b03c3146e055c7
7
- data.tar.gz: a76b70cf682be9e03d61f349356bd6dc3eaf6b16325af7fed988a9ffd43e83d2c9a7c3c590b4298f28c06da90a64814785247e42e4f4eb09b74ce9b86c04fec6
6
+ metadata.gz: 11740fca3ba58526553c0a5ac21d2092ec1119ff7cfa78e2883d48f4e3bc4cc2fdde53e9276e2369ed173a2c94f8662fdcb5479daf06346e44d13d420c57c099
7
+ data.tar.gz: a03e11f02681870cb1552d4c4a05d7f1de37d25da9a50e98b29bc1ae7c8e4ef2c54b11cb7cb41bbcdec529851ec309596bba5d864fa957dbcede26cd6c96eca2
@@ -3,11 +3,26 @@ module Cats
3
3
  class DispatchPlansController < ApplicationController
4
4
  include Common
5
5
 
6
+ def plans_for_user
7
+ plans = Cats::Core::DispatchPlan.where(prepared_by: current_user)
8
+ render json: { success: true, data: serialize(plans) }
9
+ end
10
+
6
11
  def filter
7
12
  query = Cats::Core::DispatchPlan.ransack(params[:q])
8
13
  render json: { success: true, data: serialize(query.result) }
9
14
  end
10
15
 
16
+ def create
17
+ obj = Cats::Core::DispatchPlan.new(model_params)
18
+ obj.prepared_by = current_user
19
+ if obj.save
20
+ render json: { success: true, data: serialize(obj) }, status: :created
21
+ else
22
+ render json: { success: false, error: obj.errors.full_messages[0] }, status: :unprocessable_entity
23
+ end
24
+ end
25
+
11
26
  def approve
12
27
  plan = Cats::Core::DispatchPlan.find(params[:id])
13
28
  plan.approve
@@ -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,6 +6,9 @@ module Cats
6
6
  STATUSES = [DRAFT, APPROVED].freeze
7
7
 
8
8
  belongs_to :request, polymorphic: true, optional: true
9
+ belongs_to :prepared_by, class_name: 'Cats::Core::User'
10
+ belongs_to :approved_by, class_name: 'Cats::Core::User', optional: true
11
+
9
12
  has_many :dispatch_plan_items
10
13
 
11
14
  validates :reference_no, presence: true, uniqueness: true
@@ -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,15 @@
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
+ end
14
+ end
15
+ 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,12 +1,12 @@
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 }
8
8
  validates :rank, numericality: { greater_than: 0 }, allow_nil: true
9
- validate :validate_winner_is_set_for_rank
9
+ validate :validate_rank_is_set_for_winner
10
10
 
11
11
  delegate(:name, to: :transporter, prefix: true)
12
12
 
@@ -18,10 +18,10 @@ module Cats
18
18
  save!
19
19
  end
20
20
 
21
- def validate_winner_is_set_for_rank
22
- return if winner
21
+ def validate_rank_is_set_for_winner
22
+ return if rank
23
23
 
24
- errors.add(:rank, 'cannot be set for a non-winning offer.') if rank
24
+ errors.add(:winner, 'cannot be set for a non-ranked offer.') if winner
25
25
  end
26
26
  end
27
27
  end
@@ -6,6 +6,8 @@ module Cats
6
6
  belongs_to :destination, class_name: 'Cats::Core::Location'
7
7
  belongs_to :commodity
8
8
 
9
+ has_many :transport_offers
10
+
9
11
  delegate(:name, to: :source, prefix: true)
10
12
  delegate(:name, to: :destination, prefix: true)
11
13
  delegate(:name, to: :commodity, prefix: true)
@@ -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
@@ -33,6 +33,7 @@ Cats::Core::Engine.routes.draw do
33
33
  get 'stores', controller: :users, action: :stores
34
34
  get 'warehouse', controller: :users, action: :warehouse
35
35
  get 'hub', controller: :users, action: :hub
36
+ get 'plans', controller: :dispatch_plans, action: :plans_for_user
36
37
  post 'assign_role'
37
38
  post 'revoke_role'
38
39
  end
@@ -65,6 +66,7 @@ Cats::Core::Engine.routes.draw do
65
66
  end
66
67
  resources :currencies, except: %i[destroy]
67
68
  resources :unit_of_measures, except: %i[destroy]
69
+ resources :routes, except: %i[destroy]
68
70
 
69
71
  post '/dispatch_plans/filter', controller: :dispatch_plans, action: :filter
70
72
  resources :dispatch_plans do
@@ -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
@@ -7,6 +7,15 @@ class CreateCatsCoreDispatchPlans < ActiveRecord::Migration[6.1]
7
7
  t.references :request, polymorphic: true
8
8
  t.boolean :upstream, null: false, default: false
9
9
 
10
+ t.references :prepared_by,
11
+ null: false,
12
+ index: { name: 'pb_on_dp_indx' },
13
+ foreign_key: { to_table: :cats_core_users }
14
+ t.references :approved_by,
15
+ null: true,
16
+ index: { name: 'ab_on_dp_indx' },
17
+ foreign_key: { to_table: :cats_core_users }
18
+
10
19
  t.timestamps
11
20
  end
12
21
  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.14'.freeze
3
+ VERSION = '1.2.18'.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,5 +4,7 @@ FactoryBot.define do
4
4
  status { Cats::Core::DispatchPlan::DRAFT }
5
5
  request { nil }
6
6
  upstream { false }
7
+ prepared_by factory: :user
8
+ approved_by { nil }
7
9
  end
8
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.14
4
+ version: 1.2.18
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-12 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
@@ -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
@@ -343,6 +350,7 @@ files:
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
@@ -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,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,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