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 +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 -1
- data/app/models/cats/core/transport_request_item.rb +14 -0
- data/app/models/cats/core/user.rb +4 -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: 5cd22f5d1828025591dc9c478cac117524de3bf179379ce32f8866d5b7765b50
|
4
|
+
data.tar.gz: d4aa1ad82b39cbe515bd06508abac047cdb28f0acb6b508a132bc5cf84e30ac5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8210d5329e61312fc0150fe91e99330740e0a31d33078aa140c215b706ac329fb6fed6958d852942ab354fc4ffaee0200f313dc4f8c46d448ae0eb129ec2f5d
|
7
|
+
data.tar.gz: 830891e351410797b6b882905db148df50912bf3903dc29a8041c0f22563ce5c50970150c7cd743881abff66bfd80138e6feab34b181d4af0bcf4ddb1bc1526a
|
@@ -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,6 +1,6 @@
|
|
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
|
@@ -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
|
@@ -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.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
|
+
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
|