comee_core 0.1.29 → 0.1.31

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: 589381bfd5e0931074d18a87c8559e42edb1b3eb07adf97603609ce29f4f50a1
4
- data.tar.gz: 05bee510e99019aab8d77cdec3b04a4c46e5942f659c1408cb313f9c52ede5d4
3
+ metadata.gz: 5cd7848381270134d19787687f958edee66f77eaaeb6a04d72d422f0fcdf1ea9
4
+ data.tar.gz: 32408a7fb537503ec05947ed99b4547bbb2494af12884a1e11c031e6c577d0a2
5
5
  SHA512:
6
- metadata.gz: cec0657364d59286b622ab05ab5604a2ed2c516b1ea1696127251e773e46c3baf957459f3b6b6e78768ea7c631fe5a845e055527926546ada1530dfb22e58e34
7
- data.tar.gz: 86d63cae7ea2efafb19dbd28950d2a1d5ed1e6c05af0ca4a2a4e6f21296d85208f2173f4844e9887180825480ef1c3dec603a3c60207c0530844d05b1e8246d8
6
+ metadata.gz: fd8973d61ccb97551156b1d51707a07355ba32c8f6bd236052aac2e256af26c1477746f4bd95e71f291d4481d2f205e7de449af90afddc1dd81be336296215f1
7
+ data.tar.gz: 21f6968a9c21f32473eb09de2c468684c4557ea82510fe36ebe07aa6fcfe5261b93476bd5ddb2c50d9b2553c79b21cd505d03fe03a6f51d26f09227f0dd296ef
@@ -2,6 +2,7 @@ module Comee
2
2
  module Core
3
3
  class ApplicationController < ActionController::API
4
4
  include Comee::Core::Pagination
5
+
5
6
  before_action :authenticate
6
7
 
7
8
  def current_user
@@ -3,6 +3,13 @@ module Comee
3
3
  class ClientPricesController < ApplicationController
4
4
  include Comee::Core::Common
5
5
 
6
+ def index
7
+ super do
8
+ client_prices = Comee::Core::ClientPrice.all
9
+ client_prices.then(&paginate)
10
+ end
11
+ end
12
+
6
13
  def filter
7
14
  @client_prices = Comee::Core::ClientPrice.ransack(params[:q]).result
8
15
  render json: {success: true, data: serialize(@client_prices)}
@@ -6,7 +6,7 @@ module Comee
6
6
  belongs_to :back_order
7
7
  belongs_to :product
8
8
 
9
- validates :item_status, :from, :to, presence: true
9
+ validates :item_status, :from, :to, :delivery_date, presence: true
10
10
  validates :requested_quantity, :requested_unit_price, :supplier_quantity, :supplier_unit_price,
11
11
  presence: true, numericality: {greater_than: 0}
12
12
 
@@ -0,0 +1,8 @@
1
+ module Comee
2
+ module Core
3
+ class EdiOrder < ApplicationRecord
4
+ validates :data, :status, presence: true
5
+ enum :status, {unprocessed: 0, processed: 1}
6
+ end
7
+ end
8
+ end
@@ -14,8 +14,11 @@ module Comee
14
14
  def validate_primary_price
15
15
  return unless product && primary
16
16
 
17
- count = MasterPrice.where(product: product, primary: true, active: true).count
18
- errors.add(:base, "There is already a primary supplier for item '#{product.code}'") if count.positive?
17
+ count = MasterPrice.where(product: product, primary: true, status: MasterPrice.statuses[:current]).count
18
+ return unless count.positive? && primary && MasterPrice.statuses[status] == MasterPrice.statuses[:current]
19
+
20
+ errors.add(:base,
21
+ "There is already a primary supplier for item '#{product.code}'")
19
22
  end
20
23
 
21
24
  def validate_purchase_price_validity_dates
@@ -15,6 +15,7 @@ class CreateComeeCoreBackOrderItems < ActiveRecord::Migration[7.0]
15
15
  t.float :supplier_unit_price, null: false
16
16
  t.date :from, null: false
17
17
  t.date :to, null: false
18
+ t.date :delivery_date, null: false
18
19
  t.integer :item_status, null: false, default: 0
19
20
  t.string :remark
20
21
 
@@ -0,0 +1,10 @@
1
+ class CreateComeeCoreEdiOrders < ActiveRecord::Migration[7.1]
2
+ def change
3
+ create_table :comee_core_edi_orders do |t|
4
+ t.jsonb :data, null: false
5
+ t.integer :status, null: false, default: 0
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.1.29".freeze
3
+ VERSION = "0.1.31".freeze
4
4
  end
5
5
  end
@@ -6,6 +6,7 @@ FactoryBot.define do
6
6
  requested_unit_price { 50 }
7
7
  supplier_quantity { 5 }
8
8
  supplier_unit_price { 55 }
9
+ delivery_date { Date.current.advance(days: 6) }
9
10
  from { Date.current }
10
11
  to { Date.current.advance(months: 1) }
11
12
  item_status { Comee::Core::BackOrderItem.item_statuses[:available] }
@@ -1,7 +1,7 @@
1
1
  FactoryBot.define do
2
2
  factory :client, class: "Comee::Core::Client" do
3
3
  user
4
- code { Faker::Alphanumeric.alpha(number: 8) }
4
+ code { Faker::Alphanumeric.unique.alpha(number: 8) }
5
5
  name { Faker::Name.name }
6
6
  address { Faker::Address.full_address }
7
7
  locale { "en" }
@@ -0,0 +1,6 @@
1
+ FactoryBot.define do
2
+ factory :edi_order, class: "Comee::Core::EdiOrder" do
3
+ data { {payload: ""} }
4
+ status { 1 }
5
+ end
6
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comee_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.29
4
+ version: 0.1.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-01 00:00:00.000000000 Z
11
+ date: 2023-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -150,6 +150,20 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rubocop-rspec
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: shoulda-matchers
155
169
  requirement: !ruby/object:Gem::Requirement
@@ -254,6 +268,7 @@ files:
254
268
  - app/models/comee/core/client_order.rb
255
269
  - app/models/comee/core/client_price.rb
256
270
  - app/models/comee/core/currency.rb
271
+ - app/models/comee/core/edi_order.rb
257
272
  - app/models/comee/core/field_mapping.rb
258
273
  - app/models/comee/core/inventory.rb
259
274
  - app/models/comee/core/invoice.rb
@@ -313,6 +328,7 @@ files:
313
328
  - db/migrate/20231003073316_create_comee_core_inventories.rb
314
329
  - db/migrate/20231003080017_create_comee_core_warehouse_shipments.rb
315
330
  - db/migrate/20231004105455_create_comee_core_warehouse_shipment_items.rb
331
+ - db/migrate/20231101113358_create_comee_core_edi_orders.rb
316
332
  - lib/comee/core.rb
317
333
  - lib/comee/core/engine.rb
318
334
  - lib/comee/core/version.rb
@@ -324,6 +340,7 @@ files:
324
340
  - spec/factories/comee/core/client_prices.rb
325
341
  - spec/factories/comee/core/clients.rb
326
342
  - spec/factories/comee/core/currencies.rb
343
+ - spec/factories/comee/core/edi_orders.rb
327
344
  - spec/factories/comee/core/field_mappings.rb
328
345
  - spec/factories/comee/core/inventories.rb
329
346
  - spec/factories/comee/core/invoice_items.rb