cats_core 1.2.7 → 1.2.11

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: ca3e2b07298417bdd0c747df150ae9a58934408502bb9f7f4725a5c80a823c7f
4
- data.tar.gz: 3e95c45ac93a996b21bc66488679af6fe02e6867a4443ac585f94c69eea0c79a
3
+ metadata.gz: d9f57a513afb90596f709408275f30e41f9b4e4b45fe5807db6c3ef743e11b72
4
+ data.tar.gz: ecbdbe4277fa2d4fff4558a3936aa7cc6668a0bc62d1660ba86b6c90cfa44801
5
5
  SHA512:
6
- metadata.gz: 27816ccd1f35816d5fc931e8e4e8fd192189a67f2d92697914cf64826cafeff778a52a305891ab6e8d06f3b71df12cd620907813539188b8dfa53b08aaba35fe
7
- data.tar.gz: e09c67befdb2122d236d1cbf2bdcb354fedaf48a098b533af46be85e0119b13c582bffe48497a44f20830455d2668ea42e63b95e83aad977a8393e8f6c17da21
6
+ metadata.gz: 568910a95c3524abeb0b0aa227d1bb8fb505e1474610c22ce23588572550fe978c099f5c1ec78c43895db16bb97653660580a9c516a7d53babda91445eaf5847
7
+ data.tar.gz: 0257f48eef8cce083a1b1783d4a744ded17c39feac5c016950a4b4509b145a139eaeb4632e7f5c3b33f8a95ea6e811e061941e6051c2b2ede174c9087bc0ee09
@@ -1,10 +1,12 @@
1
1
  module Cats
2
2
  module Core
3
- class TransportServiceOffer < ApplicationRecord
4
- belongs_to :transport_service_request_item
3
+ class TransportOffer < ApplicationRecord
4
+ belongs_to :transport_request_item
5
5
  belongs_to :transporter
6
6
 
7
7
  validates :price, presence: true, numericality: { greater_than: 0 }
8
+
9
+ delegate(:name, to: :transporter, prefix: true)
8
10
  end
9
11
  end
10
12
  end
@@ -1,19 +1,20 @@
1
1
  module Cats
2
2
  module Core
3
- class TransportServiceRequest < ApplicationRecord
3
+ class TransportRequest < ApplicationRecord
4
4
  DRAFT = 'Draft'.freeze
5
5
  APPROVED = 'Approved'.freeze
6
6
  STATUSES = [DRAFT, APPROVED].freeze
7
7
 
8
8
  belongs_to :requested_by, class_name: 'Cats::Core::User'
9
9
  belongs_to :approved_by, class_name: 'Cats::Core::User', optional: true
10
+ has_many :transport_request_items
10
11
 
11
12
  validates :reference_no, :request_date, :status, presence: true
12
13
  validates :reference_no, uniqueness: true
13
14
  validates :status, inclusion: { in: STATUSES }
14
15
 
15
- delegate(:full_name, to: :requested_by, prefix: true)
16
- delegate(:full_name, to: :approved_by, prefix: true)
16
+ delegate(:full_name, to: :requested_by, prefix: true, allow_nil: true)
17
+ delegate(:full_name, to: :approved_by, prefix: true, allow_nil: true)
17
18
  end
18
19
  end
19
20
  end
@@ -0,0 +1,14 @@
1
+ module Cats
2
+ module Core
3
+ class TransportRequestItem < ApplicationRecord
4
+ belongs_to :transport_request
5
+ belongs_to :source, class_name: 'Cats::Core::Location'
6
+ belongs_to :destination, class_name: 'Cats::Core::Location'
7
+ belongs_to :commodity
8
+
9
+ delegate(:name, to: :source, prefix: true)
10
+ delegate(:name, to: :destination, prefix: true)
11
+ delegate(:name, to: :commodity, prefix: true)
12
+ end
13
+ end
14
+ end
@@ -1,6 +1,6 @@
1
- class CreateCatsCoreTransportServiceRequests < ActiveRecord::Migration[6.1]
1
+ class CreateCatsCoreTransportRequests < ActiveRecord::Migration[6.1]
2
2
  def change
3
- create_table :cats_core_transport_service_requests do |t|
3
+ create_table :cats_core_transport_requests do |t|
4
4
  t.string :reference_no, unique: true
5
5
  t.date :request_date, null: false
6
6
  t.string :status, null: false, default: 'Draft'
@@ -1,21 +1,21 @@
1
- class CreateCatsCoreTransportServiceRequestItems < ActiveRecord::Migration[6.1]
1
+ class CreateCatsCoreTransportRequestItems < ActiveRecord::Migration[6.1]
2
2
  def change
3
- create_table :cats_core_transport_service_request_items do |t|
4
- t.references :transport_service_request,
3
+ create_table :cats_core_transport_request_items do |t|
4
+ t.references :transport_request,
5
5
  null: false,
6
- index: { name: 'tsri_on_tsr_indx' },
7
- foreign_key: { to_table: :cats_core_transport_service_requests }
6
+ index: { name: 'tri_on_tr_indx' },
7
+ foreign_key: { to_table: :cats_core_transport_requests }
8
8
  t.references :source,
9
9
  null: false,
10
- index: { name: 'tsri_on_source_indx' },
10
+ index: { name: 'tri_on_source_indx' },
11
11
  foreign_key: { to_table: :cats_core_locations }
12
12
  t.references :destination,
13
13
  null: false,
14
- index: { name: 'tsri_on_destination_indx'},
14
+ index: { name: 'tri_on_destination_indx'},
15
15
  foreign_key: { to_table: :cats_core_locations }
16
16
  t.references :commodity,
17
17
  null: false,
18
- index: { name: 'tsri_on_commodity_indx' },
18
+ index: { name: 'tri_on_commodity_indx' },
19
19
  foreign_key: { to_table: :cats_core_commodities }
20
20
 
21
21
  t.timestamps
@@ -0,0 +1,17 @@
1
+ class CreateCatsCoreTransportOffers < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_transport_offers do |t|
4
+ t.references :transport_request_item,
5
+ null: false,
6
+ index: { name: 'to_on_tri_indx' },
7
+ foreign_key: { to_table: :cats_core_transport_request_items }
8
+ t.references :transporter,
9
+ null: false,
10
+ index: { name: 'to_on_transporter_indx' },
11
+ foreign_key: { to_table: :cats_core_transporters }
12
+ t.float :price, null: false
13
+
14
+ t.timestamps
15
+ end
16
+ end
17
+ end
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.2.7'.freeze
3
+ VERSION = '1.2.11'.freeze
4
4
  end
5
5
  end
@@ -0,0 +1,7 @@
1
+ FactoryBot.define do
2
+ factory :transport_offer, class: 'Cats::Core::TransportOffer' do
3
+ transport_request_item
4
+ transporter
5
+ price { 100 }
6
+ end
7
+ end
@@ -0,0 +1,8 @@
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,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :transport_service_request, class: 'Cats::Core::TransportServiceRequest' do
2
+ factory :transport_request, class: 'Cats::Core::TransportRequest' do
3
3
  reference_no { FFaker::Name.name }
4
4
  request_date { Date.today }
5
5
  requested_by factory: :user
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.7
4
+ version: 1.2.11
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-11 00:00:00.000000000 Z
11
+ date: 2021-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -287,9 +287,9 @@ files:
287
287
  - app/models/cats/core/store.rb
288
288
  - app/models/cats/core/supplier.rb
289
289
  - app/models/cats/core/transaction.rb
290
- - app/models/cats/core/transport_service_offer.rb
291
- - app/models/cats/core/transport_service_request.rb
292
- - app/models/cats/core/transport_service_request_item.rb
290
+ - app/models/cats/core/transport_offer.rb
291
+ - app/models/cats/core/transport_request.rb
292
+ - app/models/cats/core/transport_request_item.rb
293
293
  - app/models/cats/core/transporter.rb
294
294
  - app/models/cats/core/unit_of_measure.rb
295
295
  - app/models/cats/core/user.rb
@@ -359,9 +359,9 @@ files:
359
359
  - db/migrate/20211002050739_create_cats_core_notification_rules.rb
360
360
  - db/migrate/20211024063240_add_status_to_cats_core_rhn_requests.rb
361
361
  - db/migrate/20211030133752_add_status_to_cats_core_commodities.rb
362
- - db/migrate/20211209155113_create_cats_core_transport_service_requests.rb
363
- - db/migrate/20211209155915_create_cats_core_transport_service_request_items.rb
364
- - db/migrate/20211209160126_create_cats_core_transport_service_offers.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
365
365
  - lib/cats/core.rb
366
366
  - lib/cats/core/engine.rb
367
367
  - lib/cats/core/version.rb
@@ -403,9 +403,9 @@ files:
403
403
  - spec/factories/cats/core/stacks.rb
404
404
  - spec/factories/cats/core/stores.rb
405
405
  - spec/factories/cats/core/suppliers.rb
406
- - spec/factories/cats/core/transport_service_offers.rb
407
- - spec/factories/cats/core/transport_service_request_items.rb
408
- - spec/factories/cats/core/transport_service_requests.rb
406
+ - 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
409
  - spec/factories/cats/core/transporters.rb
410
410
  - spec/factories/cats/core/unit_of_measures.rb
411
411
  - spec/factories/cats/core/users.rb
@@ -1,10 +0,0 @@
1
- module Cats
2
- module Core
3
- class TransportServiceRequestItem < ApplicationRecord
4
- belongs_to :transport_service_request
5
- belongs_to :source, class_name: 'Cats::Core::Location'
6
- belongs_to :destination, class_name: 'Cats::Core::Location'
7
- belongs_to :commodity
8
- end
9
- end
10
- end
@@ -1,17 +0,0 @@
1
- class CreateCatsCoreTransportServiceOffers < ActiveRecord::Migration[6.1]
2
- def change
3
- create_table :cats_core_transport_service_offers do |t|
4
- t.references :transport_service_request_item,
5
- null: false,
6
- index: { name: 'tso_on_tsri_indx' },
7
- foreign_key: { to_table: :cats_core_transport_service_request_items }
8
- t.references :transporter,
9
- null: false,
10
- index: { name: 'tso_on_transporter_indx' },
11
- foreign_key: { to_table: :cats_core_transporters }
12
- t.float :price, null: false
13
-
14
- t.timestamps
15
- end
16
- end
17
- end
@@ -1,7 +0,0 @@
1
- FactoryBot.define do
2
- factory :transport_service_offer, class: 'Cats::Core::TransportServiceOffer' do
3
- transport_service_request_item
4
- transporter
5
- price { 100 }
6
- end
7
- end
@@ -1,8 +0,0 @@
1
- FactoryBot.define do
2
- factory :transport_service_request_item, class: 'Cats::Core::TransportServiceRequestItem' do
3
- transport_service_request
4
- source factory: :location
5
- destination factory: :location
6
- commodity
7
- end
8
- end