comee_core 0.1.18 → 0.1.20

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: eee3ab42e5f0909fdd7de5f6d1fc073a4fc79b34a606e3d87e4580b3770ebfb7
4
- data.tar.gz: 44bc512432f7732f9b2e447d2a2cf0e2d3b54f73f93d6224622957c6c6b874d2
3
+ metadata.gz: d5e8471a0a6816ac4e692f01fc746c8870e7d0744065b66c7ea871d046dbe347
4
+ data.tar.gz: 17b81b8b4d17a5bedaf3ff318482d91e9d8eb6b88890fe94f5860c24dde89911
5
5
  SHA512:
6
- metadata.gz: 8afe5c968f62a1ce3b4831d6f76fec04818b085f28c8ef14853c84dbdee92768e429757362bf246993387aa0dbedbacac2106444e58497fd60b8f99373c1462f
7
- data.tar.gz: bd830637c78c8bca22da8bd19baf3e3470c1e7e123fb5f4afb4711a459e0ebd71b28f1e7894af61387a88fe222110efbb127f4c5a822cca8b587c50a443c9a75
6
+ metadata.gz: a42d869c763e3ac1219c9480bdb537d76b7b1da9a824c96be5de0479dba4a578cf8ca0492fb4d29a609034778526cf80dee52492b057717c7d73e4129f23aa4f
7
+ data.tar.gz: 32adccf22aecabe880f3e0d350e3660ae00c920d91add27737e094101268ad9a1be6d27bfcd2d72ca4be8e6edc2bde1c2442c332660735bfa602e95f1d1b9a2a
@@ -0,0 +1,18 @@
1
+ module Comee
2
+ module Core
3
+ class ClientPricesController < ApplicationController
4
+ include Comee::Core::Common
5
+
6
+ def filter
7
+ @client_prices = Comee::Core::ClientPrice.ransack(params[:q]).result
8
+ render json: {success: true, data: serialize(@client_prices)}
9
+ end
10
+
11
+ private
12
+
13
+ def model_params
14
+ params.require(:payload).permit(:valid_from, :valid_to, :price, :status, :product_id, :discount, :client_id, :previous_price)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,7 @@
1
+ module Comee
2
+ module Core
3
+ class ClientPriceSerializer < ActiveModel::Serializer
4
+ attributes :id, :valid_from, :valid_to, :price, :status, :product, :client, :previous_price
5
+ end
6
+ end
7
+ end
data/config/routes.rb CHANGED
@@ -19,4 +19,6 @@ Comee::Core::Engine.routes.draw do
19
19
  resources :units
20
20
  resources :users
21
21
  resources :clients
22
+ post "/client_prices/filter", controller: :client_prices, action: :filter
23
+ resources :client_prices
22
24
  end
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.1.18"
3
+ VERSION = "0.1.20"
4
4
  end
5
5
  end
@@ -7,5 +7,6 @@ FactoryBot.define do
7
7
  product
8
8
  client
9
9
  discount { 0 }
10
+ previous_price { nil }
10
11
  end
11
12
  end
@@ -11,5 +11,6 @@ FactoryBot.define do
11
11
  margin { 10.0 }
12
12
  product
13
13
  supplier
14
+ previous_price { nil }
14
15
  end
15
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comee_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
@@ -232,6 +232,7 @@ files:
232
232
  - Rakefile
233
233
  - app/controllers/comee/core/access_controller.rb
234
234
  - app/controllers/comee/core/application_controller.rb
235
+ - app/controllers/comee/core/client_prices_controller.rb
235
236
  - app/controllers/comee/core/clients_controller.rb
236
237
  - app/controllers/comee/core/currencies_controller.rb
237
238
  - app/controllers/comee/core/notifications_controller.rb
@@ -266,6 +267,7 @@ files:
266
267
  - app/models/comee/core/unit.rb
267
268
  - app/models/comee/core/user.rb
268
269
  - app/notifications/comee/core/new_order_notification.rb
270
+ - app/serializers/comee/core/client_price_serializer.rb
269
271
  - app/serializers/comee/core/client_serializer.rb
270
272
  - app/serializers/comee/core/currency_serializer.rb
271
273
  - app/serializers/comee/core/product_serializer.rb