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 +4 -4
- data/app/models/cats/core/{transport_service_offer.rb → transport_offer.rb} +4 -2
- data/app/models/cats/core/{transport_service_request.rb → transport_request.rb} +4 -3
- data/app/models/cats/core/transport_request_item.rb +14 -0
- data/db/migrate/{20211209155113_create_cats_core_transport_service_requests.rb → 20211209155113_create_cats_core_transport_requests.rb} +2 -2
- data/db/migrate/{20211209155915_create_cats_core_transport_service_request_items.rb → 20211209155915_create_cats_core_transport_request_items.rb} +8 -8
- data/db/migrate/20211209160126_create_cats_core_transport_offers.rb +17 -0
- data/lib/cats/core/version.rb +1 -1
- data/spec/factories/cats/core/transport_offers.rb +7 -0
- data/spec/factories/cats/core/transport_request_items.rb +8 -0
- data/spec/factories/cats/core/{transport_service_requests.rb → transport_requests.rb} +1 -1
- metadata +11 -11
- data/app/models/cats/core/transport_service_request_item.rb +0 -10
- data/db/migrate/20211209160126_create_cats_core_transport_service_offers.rb +0 -17
- data/spec/factories/cats/core/transport_service_offers.rb +0 -7
- data/spec/factories/cats/core/transport_service_request_items.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9f57a513afb90596f709408275f30e41f9b4e4b45fe5807db6c3ef743e11b72
|
4
|
+
data.tar.gz: ecbdbe4277fa2d4fff4558a3936aa7cc6668a0bc62d1660ba86b6c90cfa44801
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 568910a95c3524abeb0b0aa227d1bb8fb505e1474610c22ce23588572550fe978c099f5c1ec78c43895db16bb97653660580a9c516a7d53babda91445eaf5847
|
7
|
+
data.tar.gz: 0257f48eef8cce083a1b1783d4a744ded17c39feac5c016950a4b4509b145a139eaeb4632e7f5c3b33f8a95ea6e811e061941e6051c2b2ede174c9087bc0ee09
|
@@ -1,10 +1,12 @@
|
|
1
1
|
module Cats
|
2
2
|
module Core
|
3
|
-
class
|
4
|
-
belongs_to :
|
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
|
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
|
1
|
+
class CreateCatsCoreTransportRequests < ActiveRecord::Migration[6.1]
|
2
2
|
def change
|
3
|
-
create_table :
|
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
|
1
|
+
class CreateCatsCoreTransportRequestItems < ActiveRecord::Migration[6.1]
|
2
2
|
def change
|
3
|
-
create_table :
|
4
|
-
t.references :
|
3
|
+
create_table :cats_core_transport_request_items do |t|
|
4
|
+
t.references :transport_request,
|
5
5
|
null: false,
|
6
|
-
index: { name: '
|
7
|
-
foreign_key: { to_table: :
|
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: '
|
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: '
|
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: '
|
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
|
data/lib/cats/core/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
FactoryBot.define do
|
2
|
-
factory :
|
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.
|
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
|
+
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/
|
291
|
-
- app/models/cats/core/
|
292
|
-
- app/models/cats/core/
|
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/
|
363
|
-
- db/migrate/
|
364
|
-
- db/migrate/
|
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/
|
407
|
-
- spec/factories/cats/core/
|
408
|
-
- spec/factories/cats/core/
|
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
|