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 +4 -4
- data/app/controllers/comee/core/fulfillment_centers_controller.rb +13 -0
- data/app/controllers/comee/core/products_controller.rb +5 -0
- data/app/models/comee/core/shipment_instruction.rb +4 -0
- data/app/models/comee/core/time_slot.rb +16 -0
- data/app/models/comee/core/transport_availability.rb +8 -0
- data/app/serializers/comee/core/fulfillment_center_serializer.rb +7 -0
- data/config/routes.rb +13 -5
- data/db/migrate/20240109185749_create_comee_core_transport_availability.rb +12 -0
- data/db/migrate/20240109185931_create_comee_core_time_slots.rb +14 -0
- data/lib/comee/core/version.rb +1 -1
- data/spec/factories/comee/core/time_slots.rb +7 -0
- data/spec/factories/comee/core/transport_availabilities.rb +12 -0
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65a6f4cc76af66361e5d6d21999a8a38a0c2598f83980632783f7b1add6488ca
|
4
|
+
data.tar.gz: 554dc63474d64f44982cb4aea62040ab41f65c4c93fa517afd7a08d1e04d09d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fac12797a1ebd3ae197a2622ea494cbbce2af911c0d3862510e742aa7b9a9aa1f01a37d336d5b551b80bf4440146a5541e72029a67599fda1aa733e3e7ce225e
|
7
|
+
data.tar.gz: 6c2e2ddda7b6921cb9a8c39c9138fd2d9dd8c2e8573a2bfee18191f671bf64e5b1a7dea57116a5d9b8d36d1744e5bb0cded3727c86175a5944d454fae7a1d611
|
@@ -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)}
|
@@ -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
|
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
|
-
|
12
|
-
|
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
|
-
|
114
|
-
|
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
|
data/lib/comee/core/version.rb
CHANGED
@@ -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.
|
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-
|
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
|