cats_core 1.1.8 → 1.1.12

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: e88cccfc4e2d6d554ec178e2f7e981462ace4db4fa8e43fb142b617550eadde7
4
- data.tar.gz: cb8b5bfe4186b7e2394ca8ed765d6a1c5c7c2694f503a031d42f64fce0d3b4c1
3
+ metadata.gz: 94bf88876f024323ea55e55b6a01fe74af037d2dda21c0c673d969e603d4d3ff
4
+ data.tar.gz: 865354149f6c009cec575207990fd8c5b47bbf002e5a884f6a2dd717886ba1d8
5
5
  SHA512:
6
- metadata.gz: 49cb848b9e249982677944e85e91305ebb7997237a570ce9f91cfecfedc058ea7f02052e8e8aea79ae7020ee8618998a48f1d97e26886415b807d619c25dcf73
7
- data.tar.gz: 6959a9bdb0a8474785fb1a63b6282d0f1030fcf0ed0f182246e310d73681eff892f38f64eb72c24e1d43c47541912f8292694a717676aa56916184fea63c3f47
6
+ metadata.gz: 20da152cd17a483350c82d530d24e09489b0b85a2150752b3bd008902346364cc8cd506dcd8c3c4306558ec47be7a34b5c4215e5bbba7772173b0a1d120ea42f
7
+ data.tar.gz: 5ef09f36850fcc7a1ce7af5bb5f584d4fe6c1245edc0df3ed1226985fb38e493ac9589036d749b98cdb2db75413fc68356538b1c4035ace11368504dc4bc339d
@@ -3,6 +3,11 @@ module Cats
3
3
  class DispatchTransactionsController < ApplicationController
4
4
  include Common
5
5
 
6
+ def index
7
+ transactions = Cats::Core::DispatchTransaction.where(destination_id: params[:id])
8
+ render json: { success: true, data: serialize(transactions) }
9
+ end
10
+
6
11
  private
7
12
 
8
13
  def model_params
@@ -13,6 +13,11 @@ module Cats
13
13
  render json: { success: true, data: serialize(parent.children) }
14
14
  end
15
15
 
16
+ def filter
17
+ query = Cats::Core::Location.ransack(params[:q])
18
+ render json: { success: true, data: serialize(query.result) }
19
+ end
20
+
16
21
  private
17
22
 
18
23
  def model_params
@@ -3,6 +3,11 @@ module Cats
3
3
  class ReceiptTransactionsController < ApplicationController
4
4
  include Common
5
5
 
6
+ def index
7
+ transactions = Cats::Core::ReceiptTransaction.where(source_id: params[:id])
8
+ render json: { success: true, data: serialize(transactions) }
9
+ end
10
+
6
11
  private
7
12
 
8
13
  def model_params
@@ -0,0 +1,8 @@
1
+ module Cats
2
+ module Core
3
+ class NotificationRule < ApplicationRecord
4
+ validates :code, :roles, presence: true
5
+ validates :code, uniqueness: true
6
+ end
7
+ end
8
+ end
@@ -3,8 +3,9 @@ module Cats
3
3
  class RhnRequest < ApplicationRecord
4
4
  belongs_to :commodity
5
5
 
6
- validates :reference_no, :request_date, presence: true
6
+ validates :reference_no, :request_date, :quantity, presence: true
7
7
  validates :reference_no, uniqueness: true
8
+ validates :quantity, numericality: { greater_than: 0 }
8
9
 
9
10
  delegate(:batch_no, to: :commodity, prefix: true)
10
11
  end
data/config/routes.rb CHANGED
@@ -23,6 +23,8 @@ Cats::Core::Engine.routes.draw do
23
23
  get 'warehouses', controller: :users, action: :warehouses
24
24
  end
25
25
  end
26
+
27
+ post '/locations/filter', controller: :locations, action: :filter
26
28
  resources :locations, except: %i[destroy] do
27
29
  member do
28
30
  get 'children'
@@ -59,6 +61,7 @@ Cats::Core::Engine.routes.draw do
59
61
  get '/dispatches/search', controller: :dispatches, action: :search, as: :search_dispatches
60
62
  resources :dispatches, except: %i[index destroy] do
61
63
  member do
64
+ get 'transactions', controller: :dispatch_transactions, action: :index
62
65
  get 'receipts', controller: :receipts, action: :index
63
66
  get 'commodity'
64
67
  post 'approve'
@@ -66,12 +69,13 @@ Cats::Core::Engine.routes.draw do
66
69
  post 'confirm'
67
70
  end
68
71
  end
69
- resources :dispatch_transactions, except: %i[new edit destroy]
72
+ resources :dispatch_transactions, except: %i[index new edit destroy]
70
73
  resources :receipts, except: %i[index new edit destroy] do
71
74
  member do
75
+ get 'transactions', controller: :receipt_transactions, action: :index
72
76
  post 'start_stacking'
73
77
  post 'finish_stacking'
74
78
  end
75
79
  end
76
- resources :receipt_transactions, except: %i[new edit destroy]
80
+ resources :receipt_transactions, except: %i[index new edit destroy]
77
81
  end
@@ -6,6 +6,7 @@ class CreateCatsCoreRhnRequests < ActiveRecord::Migration[6.1]
6
6
  null: false,
7
7
  index: { name: 'commodity_on_rhn_indx' },
8
8
  foreign_key: { to_table: :cats_core_commodities }
9
+ t.float :quantity, null: false
9
10
  t.date :request_date, null: false
10
11
  t.string :requested_by
11
12
 
@@ -0,0 +1,10 @@
1
+ class CreateCatsCoreNotificationRules < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_notification_rules do |t|
4
+ t.string :code, unique: true
5
+ t.string :roles, array: true, null: false
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.1.8'.freeze
3
+ VERSION = '1.1.12'.freeze
4
4
  end
5
5
  end
data/lib/cats_core.rb CHANGED
@@ -5,3 +5,4 @@ require 'rolify'
5
5
  require 'jwt'
6
6
  require 'noticed'
7
7
  require 'active_model_serializers'
8
+ require 'ransack'
@@ -0,0 +1,6 @@
1
+ FactoryBot.define do
2
+ factory :notification_rule, class: 'Cats::Core::NotificationRule' do
3
+ code { FFaker::Name.name }
4
+ roles { %i[role1 role2] }
5
+ end
6
+ end
@@ -2,6 +2,7 @@ FactoryBot.define do
2
2
  factory :rhn_request, class: 'Cats::Core::RhnRequest' do
3
3
  reference_no { FFaker::Name.name }
4
4
  commodity
5
+ quantity { 100 }
5
6
  request_date { Date.today }
6
7
  requested_by { FFaker::Name.name }
7
8
  end
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.1.8
4
+ version: 1.1.12
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-09-29 00:00:00.000000000 Z
11
+ date: 2021-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 6.1.4
97
+ - !ruby/object:Gem::Dependency
98
+ name: ransack
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 2.4.2
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 2.4.2
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: rolify
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -252,6 +266,7 @@ files:
252
266
  - app/models/cats/core/menu.rb
253
267
  - app/models/cats/core/menu_item.rb
254
268
  - app/models/cats/core/notification.rb
269
+ - app/models/cats/core/notification_rule.rb
255
270
  - app/models/cats/core/operator.rb
256
271
  - app/models/cats/core/program.rb
257
272
  - app/models/cats/core/purchase_order.rb
@@ -325,6 +340,7 @@ files:
325
340
  - db/migrate/20210727074646_create_cats_core_receipts.rb
326
341
  - db/migrate/20210814160628_create_cats_core_receipt_transactions.rb
327
342
  - db/migrate/20210814175406_create_cats_core_stack_transactions.rb
343
+ - db/migrate/20211002050739_create_cats_core_notification_rules.rb
328
344
  - lib/cats/core.rb
329
345
  - lib/cats/core/engine.rb
330
346
  - lib/cats/core/version.rb
@@ -347,6 +363,7 @@ files:
347
363
  - spec/factories/cats/core/locations.rb
348
364
  - spec/factories/cats/core/menu_items.rb
349
365
  - spec/factories/cats/core/menus.rb
366
+ - spec/factories/cats/core/notification_rules.rb
350
367
  - spec/factories/cats/core/notifications.rb
351
368
  - spec/factories/cats/core/operators.rb
352
369
  - spec/factories/cats/core/programs.rb