comee_core 0.1.83 → 0.1.85

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: 76f47c496c4a524edbc87938c14f4056182ec04520fdb83c3c78d13e38a279eb
4
- data.tar.gz: ca6a83b2354cd9c1a8b3a7a61c72cbbd134b2c09bc86a445abd147ad1e69368f
3
+ metadata.gz: 65a6f4cc76af66361e5d6d21999a8a38a0c2598f83980632783f7b1add6488ca
4
+ data.tar.gz: 554dc63474d64f44982cb4aea62040ab41f65c4c93fa517afd7a08d1e04d09d1
5
5
  SHA512:
6
- metadata.gz: e2c96de79bcd9c67931f8c93b0318b48cc5677ccb1e158c3057c2d1de7d607bf7ee2db009d67cab29698ff895bf5d81d4b1a141ef86708291644b2ada7698be8
7
- data.tar.gz: a77db4503767df48c75a495a5778852779901be087ef487b1c6128816a4bb8a6645599024724405bcd198fa889e40588e03b13efba6fbd32e23f72c037f1f902
6
+ metadata.gz: fac12797a1ebd3ae197a2622ea494cbbce2af911c0d3862510e742aa7b9a9aa1f01a37d336d5b551b80bf4440146a5541e72029a67599fda1aa733e3e7ce225e
7
+ data.tar.gz: 6c2e2ddda7b6921cb9a8c39c9138fd2d9dd8c2e8573a2bfee18191f671bf64e5b1a7dea57116a5d9b8d36d1744e5bb0cded3727c86175a5944d454fae7a1d611
@@ -0,0 +1,13 @@
1
+ module Comee
2
+ module Core
3
+ class FulfillmentCentersController < ApplicationController
4
+ include Common
5
+
6
+ private
7
+
8
+ def model_params
9
+ params.require(:payload).permit(:code, :name, :address, :email, service: [])
10
+ end
11
+ end
12
+ end
13
+ end
@@ -27,6 +27,11 @@ module Comee
27
27
  render json: {success: true, data: serialize(data)}
28
28
  end
29
29
 
30
+ def categories
31
+ root = Product.find_by(code: "root")
32
+ render json: {success: true, data: serialize(root.children)}
33
+ end
34
+
30
35
  def filter
31
36
  products = Product.ransack(params[:q]).result
32
37
  render json: {success: true, data: serialize(products)}
@@ -8,6 +8,10 @@ module Comee
8
8
 
9
9
  validates :reference_no, presence: true, uniqueness: true
10
10
  validates :status, presence: true
11
+
12
+ def self.ransackable_attributes(_auth_object = nil)
13
+ %w[client_id reference_no status]
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -0,0 +1,16 @@
1
+ module Comee
2
+ module Core
3
+ class TimeSlot < ApplicationRecord
4
+ belongs_to :transport_availability
5
+
6
+ validates :from, :to, presence: true
7
+ validate :validate_time_range
8
+
9
+ def validate_time_range
10
+ return unless from && to
11
+
12
+ errors.add(:base, "From must be before to.") if from >= to
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,8 @@
1
+ module Comee
2
+ module Core
3
+ class TransportAvailability < ApplicationRecord
4
+ validates :availability_date, presence: true, uniqueness: true
5
+ validates :weekday, :weekday_short, presence: true
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ module Comee
2
+ module Core
3
+ class FulfillmentCenterSerializer < ActiveModel::Serializer
4
+ attributes :id, :code, :name, :address, :email, :service
5
+ end
6
+ end
7
+ end
data/config/routes.rb CHANGED
@@ -8,12 +8,17 @@ Comee::Core::Engine.routes.draw do
8
8
  post "mark_as_unread", controller: :notifications, action: :mark_as_unread
9
9
  end
10
10
  end
11
- post "/suppliers/filter", controller: :suppliers, action: :filter
12
- resources :suppliers
11
+ resources :suppliers do
12
+ collection do
13
+ post "filter"
14
+ end
15
+ end
13
16
  resources :products do
14
17
  collection do
15
18
  post "master_prices"
16
19
  post "client_prices"
20
+ post "filter"
21
+ get "categories"
17
22
  end
18
23
  end
19
24
  resources :product_lookups do
@@ -109,7 +114,10 @@ Comee::Core::Engine.routes.draw do
109
114
  end
110
115
  end
111
116
  resources :customs_details
112
- resources :item_statuses
113
- post "/item_statuses/filter", controller: :item_statuses, action: :filter
114
- post "/products/filter", controller: :products, action: :filter
117
+ resources :item_statuses do
118
+ collection do
119
+ post "filter"
120
+ end
121
+ end
122
+ resources :fulfillment_centers
115
123
  end
@@ -0,0 +1,12 @@
1
+ class CreateComeeCoreTransportAvailability < ActiveRecord::Migration[7.1]
2
+ def change
3
+ create_table :comee_core_transport_availabilities do |t|
4
+ t.date :availability_date, null: false
5
+ t.string :weekday, null: false
6
+ t.string :weekday_short, null: false
7
+
8
+ t.timestamps
9
+ end
10
+ add_index :comee_core_transport_availabilities, :availability_date, unique: true
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ class CreateComeeCoreTimeSlots < ActiveRecord::Migration[7.1]
2
+ def change
3
+ create_table :comee_core_time_slots do |t|
4
+ t.references :transport_availability,
5
+ null: false,
6
+ index: {name: "ta_on_ccts_indx"},
7
+ foreign_key: {to_table: :comee_core_transport_availabilities}
8
+ t.time :from, null: false
9
+ t.time :to, null: false
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.1.83".freeze
3
+ VERSION = "0.1.85".freeze
4
4
  end
5
5
  end
@@ -0,0 +1,7 @@
1
+ FactoryBot.define do
2
+ factory :time_slot, class: "Comee::Core::TimeSlot" do
3
+ transport_availability
4
+ from { Time.current.strftime("%H:%M") }
5
+ to { Time.current.advance(hours: 1).strftime("%H:%M") }
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ FactoryBot.define do
2
+ factory :transport_availability, class: "Comee::Core::TransportAvailability" do
3
+ availability_date do
4
+ d = Date.current
5
+ d.advance(days: 1) if d.wday == 7
6
+ d.advance(days: 2) if d.wday == 6
7
+ d
8
+ end
9
+ weekday { availability_date.strftime("%A") }
10
+ weekday_short { availability_date.strftime("%a") }
11
+ end
12
+ 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.83
4
+ version: 0.1.85
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-08 00:00:00.000000000 Z
11
+ date: 2024-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -288,6 +288,7 @@ files:
288
288
  - app/controllers/comee/core/customer_orders_controller.rb
289
289
  - app/controllers/comee/core/customs_details_controller.rb
290
290
  - app/controllers/comee/core/external_rfqs_controller.rb
291
+ - app/controllers/comee/core/fulfillment_centers_controller.rb
291
292
  - app/controllers/comee/core/item_statuses_controller.rb
292
293
  - app/controllers/comee/core/lookups_controller.rb
293
294
  - app/controllers/comee/core/notifications_controller.rb
@@ -343,6 +344,8 @@ files:
343
344
  - app/models/comee/core/shipment_instruction_item.rb
344
345
  - app/models/comee/core/shipment_item.rb
345
346
  - app/models/comee/core/supplier.rb
347
+ - app/models/comee/core/time_slot.rb
348
+ - app/models/comee/core/transport_availability.rb
346
349
  - app/models/comee/core/unit.rb
347
350
  - app/models/comee/core/unit_conversion.rb
348
351
  - app/models/comee/core/user.rb
@@ -356,6 +359,7 @@ files:
356
359
  - app/serializers/comee/core/customer_order_serializer.rb
357
360
  - app/serializers/comee/core/customs_detail_serializer.rb
358
361
  - app/serializers/comee/core/external_rfq_serializer.rb
362
+ - app/serializers/comee/core/fulfillment_center_serializer.rb
359
363
  - app/serializers/comee/core/item_status_serializer.rb
360
364
  - app/serializers/comee/core/lookup_serializer.rb
361
365
  - app/serializers/comee/core/master_price_serializer.rb
@@ -425,6 +429,8 @@ files:
425
429
  - db/migrate/20231207235542_create_comee_core_item_statuses.rb
426
430
  - db/migrate/20240104131607_create_comee_core_shipment_instructions.rb
427
431
  - db/migrate/20240104143246_create_comee_core_shipment_instruction_items.rb
432
+ - db/migrate/20240109185749_create_comee_core_transport_availability.rb
433
+ - db/migrate/20240109185931_create_comee_core_time_slots.rb
428
434
  - lib/comee/core.rb
429
435
  - lib/comee/core/engine.rb
430
436
  - lib/comee/core/version.rb
@@ -462,6 +468,8 @@ files:
462
468
  - spec/factories/comee/core/shipment_instructions.rb
463
469
  - spec/factories/comee/core/shipment_items.rb
464
470
  - spec/factories/comee/core/suppliers.rb
471
+ - spec/factories/comee/core/time_slots.rb
472
+ - spec/factories/comee/core/transport_availabilities.rb
465
473
  - spec/factories/comee/core/unit_conversions.rb
466
474
  - spec/factories/comee/core/units.rb
467
475
  - spec/factories/comee/core/users.rb