cats_core 1.2.6 → 1.2.10

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: b102951859559bc96354a41e5dd05582209632d2394b86ba3916100374594706
4
- data.tar.gz: b9f1ea8526f5bca4776f32e7c3a16f6dee1b32ce460e4975eebd693b00d941a9
3
+ metadata.gz: 5cd22f5d1828025591dc9c478cac117524de3bf179379ce32f8866d5b7765b50
4
+ data.tar.gz: d4aa1ad82b39cbe515bd06508abac047cdb28f0acb6b508a132bc5cf84e30ac5
5
5
  SHA512:
6
- metadata.gz: 196b1372ef0c79666b491dfc63deedee8c624ae774ee12ef14894f94471be09a6b595ca1e0a483eea5ad01e9a6afb20652aa884adaf7bf383c82be0b270e3537
7
- data.tar.gz: 8e3264080cc5cdfbab53447fc1eb59e7c6354433053d60484b0e056051aeeb35e0961f6dbc91d38a66b5cd5aa76895092cc343b1c8e37ff70c96b913e0ddb7ab
6
+ metadata.gz: f8210d5329e61312fc0150fe91e99330740e0a31d33078aa140c215b706ac329fb6fed6958d852942ab354fc4ffaee0200f313dc4f8c46d448ae0eb129ec2f5d
7
+ data.tar.gz: 830891e351410797b6b882905db148df50912bf3903dc29a8041c0f22563ce5c50970150c7cd743881abff66bfd80138e6feab34b181d4af0bcf4ddb1bc1526a
@@ -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,6 +1,6 @@
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
@@ -11,6 +11,9 @@ module Cats
11
11
  validates :reference_no, :request_date, :status, presence: true
12
12
  validates :reference_no, uniqueness: true
13
13
  validates :status, inclusion: { in: STATUSES }
14
+
15
+ delegate(:full_name, to: :requested_by, prefix: true, allow_nil: true)
16
+ delegate(:full_name, to: :approved_by, prefix: true, allow_nil: true)
14
17
  end
15
18
  end
16
19
  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
@@ -50,6 +50,10 @@ module Cats
50
50
 
51
51
  errors.add(:phone_number, 'must be 10 or 12 digits and should match with local phone pattern')
52
52
  end
53
+
54
+ def full_name
55
+ "#{first_name} #{last_name}"
56
+ end
53
57
  end
54
58
  end
55
59
  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.6'.freeze
3
+ VERSION = '1.2.10'.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.6
4
+ version: 1.2.10
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