cats_core 1.2.4 → 1.2.8
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_request.rb +12 -1
- data/app/models/cats/core/user.rb +4 -0
- data/db/migrate/20211209155113_create_cats_core_transport_service_requests.rb +9 -0
- data/lib/cats/core/version.rb +1 -1
- data/spec/factories/cats/core/transport_service_requests.rb +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 410f6f43a8f38fee7dc6fa2b1bfa35d57e33f15e34f5a2449820fe969cd94afc
|
4
|
+
data.tar.gz: e9e309081d7c9e253bf5eb5e1d1bc0ae5d78aedbcfa51585d2cc2f897e3e8edb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3945bba2c0198ca40dd78ffae146adebfa75a5404918e46e6c354098bbdd5b78e4febedc8557776f7713a660bd1bf1adb47d535b24e2697e751a1d4894054f9
|
7
|
+
data.tar.gz: 220b1eebc52a63d51bc9c3f21cdf603116ea9e74fa2adf4bd40b2732fdefb93276fcc8b64c964ba1912c3b232aa6a9d6ee1b84f2a7f7961b6623fde8d506b1a6
|
@@ -1,8 +1,19 @@
|
|
1
1
|
module Cats
|
2
2
|
module Core
|
3
3
|
class TransportServiceRequest < ApplicationRecord
|
4
|
-
|
4
|
+
DRAFT = 'Draft'.freeze
|
5
|
+
APPROVED = 'Approved'.freeze
|
6
|
+
STATUSES = [DRAFT, APPROVED].freeze
|
7
|
+
|
8
|
+
belongs_to :requested_by, class_name: 'Cats::Core::User'
|
9
|
+
belongs_to :approved_by, class_name: 'Cats::Core::User', optional: true
|
10
|
+
|
11
|
+
validates :reference_no, :request_date, :status, presence: true
|
5
12
|
validates :reference_no, uniqueness: true
|
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)
|
6
17
|
end
|
7
18
|
end
|
8
19
|
end
|
@@ -3,6 +3,15 @@ class CreateCatsCoreTransportServiceRequests < ActiveRecord::Migration[6.1]
|
|
3
3
|
create_table :cats_core_transport_service_requests do |t|
|
4
4
|
t.string :reference_no, unique: true
|
5
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 }
|
6
15
|
|
7
16
|
t.timestamps
|
8
17
|
end
|
data/lib/cats/core/version.rb
CHANGED