cats_core 1.3.1 → 1.3.2

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: 6d4aec729abe0584f124c74a2a86fbcfa0d068b6c5b968a847a4a040595e19a8
4
- data.tar.gz: 8b880262cb1ffcb7f92d1e7f2de5039feafac1805f3d9434122abd448c5dc6ea
3
+ metadata.gz: 2a6a1ea34a4402faf06a312e6fddc4ce4809df7d509a598b6802e5ac639102ef
4
+ data.tar.gz: a65237debf4b93fa53881922294caca38b7cd8079fd43a4d92d7cb072c2fa080
5
5
  SHA512:
6
- metadata.gz: 07e042748a002c29d571ec68788ac3ae3369569b41aa60affafeaa0236270bb28a64f5aebb0a48a43eb52b14beb0483b8d72b14f92649d1856b8b77496b53075
7
- data.tar.gz: 387e10b63ecdc87555742a4aad7f505324aa06d569bdf7a7358efc57820886674dd0983673f9fefc5304ed697be276baefef5f63e7961f35134c3d0181f407a6
6
+ metadata.gz: 6190f8e0a5cbb726cd0c06bcd7382683be8b570c9e6827d55791c9d949258c29a22b6a5b4a2918835e71d4d273df9e35796cc9ebed636a91e871ccefdba385a9
7
+ data.tar.gz: ba4af2345cadf310c41a1b77345bc28fa877ee5b4c258ee0a89db3ec2c43316cdb7373a067dbe82f5bceb74e5e8a91f6491415bb27a7a16b4f7b0798234f4d6f
@@ -3,6 +3,11 @@ module Cats
3
3
  class RoutesController < ApplicationController
4
4
  include Common
5
5
 
6
+ def filter
7
+ query = Cats::Core::Route.ransack(params[:q])
8
+ render json: { success: true, data: serialize(query.result) }
9
+ end
10
+
6
11
  private
7
12
 
8
13
  def model_params
@@ -10,6 +10,8 @@ module Cats
10
10
  validates :source_id, uniqueness: { scope: :destination_id }
11
11
  validate :validate_region, :validate_source, :validate_destination
12
12
 
13
+ delegate(:name, to: :region, prefix: true)
14
+
13
15
  def set_name
14
16
  return unless source && destination
15
17
 
@@ -1,7 +1,7 @@
1
1
  module Cats
2
2
  module Core
3
3
  class RouteSerializer < ActiveModel::Serializer
4
- attributes :id, :name, :source_id, :destination_id
4
+ attributes :id, :name, :source_id, :destination_id, :region_id, :region_name
5
5
  end
6
6
  end
7
7
  end
data/config/routes.rb CHANGED
@@ -66,6 +66,8 @@ Cats::Core::Engine.routes.draw do
66
66
  end
67
67
  resources :currencies, except: %i[destroy]
68
68
  resources :unit_of_measures, except: %i[destroy]
69
+
70
+ post '/routes/filter', controller: :routes, action: :filter
69
71
  resources :routes, except: %i[destroy]
70
72
 
71
73
  post '/dispatch_plans/filter', controller: :dispatch_plans, action: :filter
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.3.1'.freeze
3
+ VERSION = '1.3.2'.freeze
4
4
  end
5
5
  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.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.