cats_core 1.2.4 → 1.2.5

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: 2026abe247e382b33bd737605c3aeeb4c4a26c431e557fc98a94234314170074
4
- data.tar.gz: d154ca8293fdcf4cff3de77d33542838e759ba0b46df48e3572036f589e15486
3
+ metadata.gz: 57bd0cce4510afb100e277538b46b5d090b3a5a9c48cacd4da24d9865a3a3cdd
4
+ data.tar.gz: 93e64f75bf5fb2a953d4f1dbc01667746ed5454b67857a27f27c5a3bed6bc86a
5
5
  SHA512:
6
- metadata.gz: d92b1ea622c407e0a418a469bf6ed429e76d035b77d3a20184108fc96d0b89241ef5d54bcff3f6d8a0fc0e2158d9a70adb2bdd4a2eaaf20298ae88b758cb7097
7
- data.tar.gz: 486d2a372a236e91e17142859c90a5bbb0b80d577787ce4bc710f064176a26fafbc8caaf2030fc2d085112dc708ec89d763391d5ab9c48cea4509ab99c58447e
6
+ metadata.gz: 97092e8a99a11f22d5ad044ce913f75b5a5dc39ceb55c733ef248994a5e0686b32b6af564838127510296d8b1b3cb3bd0cae0f7f743dd3b262b9c78aa9efa2fa
7
+ data.tar.gz: abcfc0f293575c891c961da89f8a038a7d83cffbe7c0c0eebb8e1cb996bc855c38f359b868db4eefaacf630f58456ae4beeb1a75d1f4e4cb80e57ab436dbc0d3
@@ -1,8 +1,16 @@
1
1
  module Cats
2
2
  module Core
3
3
  class TransportServiceRequest < ApplicationRecord
4
- validates :reference_no, :request_date, presence: true
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'
10
+
11
+ validates :reference_no, :request_date, :status, presence: true
5
12
  validates :reference_no, uniqueness: true
13
+ validates :status, inclusion: { in: STATUSES }
6
14
  end
7
15
  end
8
16
  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: false,
13
+ index: { name: 'tsr_on_ab_indx' },
14
+ foreign_key: { to_table: :cats_core_users }
6
15
 
7
16
  t.timestamps
8
17
  end
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.2.4'.freeze
3
+ VERSION = '1.2.5'.freeze
4
4
  end
5
5
  end
@@ -2,5 +2,7 @@ FactoryBot.define do
2
2
  factory :transport_service_request, class: 'Cats::Core::TransportServiceRequest' do
3
3
  reference_no { FFaker::Name.name }
4
4
  request_date { Date.today }
5
+ requested_by factory: :user
6
+ approved_by factory: :user
5
7
  end
6
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cats_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.