comee_core 0.1.23 → 0.1.25
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/back_orders_controller.rb +2 -2
- data/app/controllers/concerns/comee/core/common.rb +15 -16
- data/app/models/comee/core/back_order.rb +7 -4
- data/app/models/comee/core/back_order_item.rb +1 -1
- data/app/models/comee/core/client_price.rb +4 -4
- data/app/models/comee/core/invoice.rb +11 -11
- data/app/models/comee/core/master_price.rb +2 -2
- data/app/models/comee/core/product.rb +3 -5
- data/app/models/comee/core/sales_order.rb +14 -14
- data/app/models/comee/core/sales_order_item.rb +3 -3
- data/app/models/comee/core/warehouse_shipment_item.rb +4 -4
- data/app/notifications/comee/core/back_order_notification.rb +1 -1
- data/app/serializers/comee/core/product_serializer.rb +1 -1
- data/app/services/comee/core/product_lookup_service.rb +1 -1
- data/app/utils/comee/core/period.rb +1 -0
- data/db/migrate/20230728014322_create_comee_core_products.rb +6 -6
- data/db/migrate/20230728122618_create_comee_core_suppliers.rb +3 -3
- data/db/migrate/20230728123039_create_comee_core_clients.rb +3 -3
- data/db/migrate/20230728123928_create_comee_core_back_orders.rb +3 -3
- data/db/migrate/20230728125723_create_comee_core_back_order_items.rb +6 -6
- data/db/migrate/20230812190652_create_comee_core_sales_orders.rb +3 -3
- data/db/migrate/20230812212844_create_comee_core_sales_order_items.rb +6 -6
- data/db/migrate/20230813235946_create_comee_core_master_prices.rb +12 -12
- data/db/migrate/20230814151601_create_comee_core_client_prices.rb +12 -12
- data/db/migrate/20230914041307_create_comee_core_external_products.rb +6 -6
- data/db/migrate/20230915205522_create_comee_core_invoices.rb +3 -3
- data/db/migrate/20230915205648_create_comee_core_invoice_items.rb +6 -6
- data/db/migrate/20230929120051_create_comee_core_field_mappings.rb +3 -3
- data/db/migrate/20230929130910_create_comee_core_client_orders.rb +6 -6
- data/db/migrate/20231003073316_create_comee_core_inventories.rb +3 -3
- data/db/migrate/20231003080017_create_comee_core_warehouse_shipments.rb +3 -3
- data/db/migrate/20231004105455_create_comee_core_warehouse_shipment_items.rb +6 -6
- data/lib/comee/core/engine.rb +1 -3
- data/lib/comee/core/version.rb +1 -1
- data/spec/factories/comee/core/master_prices.rb +1 -0
- metadata +9 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faed63ef20703db26547cca5e061d85a293bd15e02ecb110243828333876d961
|
4
|
+
data.tar.gz: 17a1247d0236ea0059abdfade2674014d6be1dcb50cd8a0064cfafa84ca38f3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38cda2bc16fd07ce42462795fe83f4f0fba57446a902b67a066610294388ebc9f23bab6a82a0d3c111ed09c13456a3b02f6a3d65b576c3eb8bf2bdf1241f026a
|
7
|
+
data.tar.gz: 53ad90ec924be6ebc4e3e6d3086e8a2b03424d914e5fa816f8c7460f8a3c795779721c876e1a5f3d0caef5badc974356f8b117124349e0277121f36fba489bd7
|
@@ -16,7 +16,7 @@ module Comee
|
|
16
16
|
Comee::Core::BackOrderNotification.with(back_order: @obj).deliver(@obj.supplier.user)
|
17
17
|
render json: {success: true, data: serialize(@obj.reload)}
|
18
18
|
end
|
19
|
-
rescue => e
|
19
|
+
rescue StandardError => e
|
20
20
|
render json: {success: false, error: e.message}
|
21
21
|
end
|
22
22
|
|
@@ -27,7 +27,7 @@ module Comee
|
|
27
27
|
|
28
28
|
def model_params
|
29
29
|
params.require(:payload).permit(:order_number, :order_date, :delivery_date, :supplier_id, :terms,
|
30
|
-
|
30
|
+
:delivery_address, :invoice_address, :status, :remark)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -10,10 +10,10 @@ module Comee
|
|
10
10
|
|
11
11
|
def index
|
12
12
|
data = if block_given?
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
yield
|
14
|
+
else
|
15
|
+
@clazz.all
|
16
|
+
end
|
17
17
|
render json: {success: true, data: serialize(data)}
|
18
18
|
end
|
19
19
|
|
@@ -23,31 +23,31 @@ module Comee
|
|
23
23
|
|
24
24
|
def create
|
25
25
|
obj = if block_given?
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
yield
|
27
|
+
else
|
28
|
+
@clazz.new(model_params)
|
29
|
+
end
|
30
30
|
if obj.save
|
31
31
|
render json: {success: true, data: serialize(obj)}, status: :created
|
32
32
|
else
|
33
33
|
render json: {success: false, error: obj.errors.full_messages[0]}, status: :unprocessable_entity
|
34
34
|
end
|
35
|
-
rescue => e
|
35
|
+
rescue StandardError => e
|
36
36
|
render json: {success: false, error: e.message}
|
37
37
|
end
|
38
38
|
|
39
39
|
def update
|
40
40
|
obj = if block_given?
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
yield
|
42
|
+
else
|
43
|
+
obj = @obj
|
44
|
+
end
|
45
45
|
if obj.update(model_params)
|
46
46
|
render json: {success: true, data: serialize(obj)}
|
47
47
|
else
|
48
48
|
render json: {success: false, error: obj.errors.full_messages[0]}, status: :unprocessable_entity
|
49
49
|
end
|
50
|
-
rescue => e
|
50
|
+
rescue StandardError => e
|
51
51
|
render json: {success: false, error: e.message}
|
52
52
|
end
|
53
53
|
|
@@ -66,8 +66,7 @@ module Comee
|
|
66
66
|
end
|
67
67
|
|
68
68
|
# This class should be overridden by respective child controllers
|
69
|
-
def model_params
|
70
|
-
end
|
69
|
+
def model_params; end
|
71
70
|
end
|
72
71
|
end
|
73
72
|
end
|
@@ -13,11 +13,11 @@ module Comee
|
|
13
13
|
|
14
14
|
delegate(:name, to: :supplier, prefix: true)
|
15
15
|
|
16
|
-
def self.ransackable_attributes(
|
17
|
-
[
|
16
|
+
def self.ransackable_attributes(_auth_object = nil)
|
17
|
+
%w[delivery_address delivery_date invoice_address order_date order_number status supplier_id]
|
18
18
|
end
|
19
19
|
|
20
|
-
def self.ransackable_associations(
|
20
|
+
def self.ransackable_associations(_auth_object = nil)
|
21
21
|
[]
|
22
22
|
end
|
23
23
|
|
@@ -37,7 +37,10 @@ module Comee
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def submit
|
40
|
-
|
40
|
+
unless BackOrder.statuses[status] == BackOrder.statuses[:draft]
|
41
|
+
raise(StandardError,
|
42
|
+
"Back order can't be submitted if it is not in draft state.")
|
43
|
+
end
|
41
44
|
|
42
45
|
self.status = BackOrder.statuses[:submitted]
|
43
46
|
save
|
@@ -8,7 +8,7 @@ module Comee
|
|
8
8
|
|
9
9
|
validates :item_status, :from, :to, 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
|
|
13
13
|
delegate(:code, :name, :description, to: :product, prefix: true)
|
14
14
|
delegate(:unit_code, :unit_name, to: :product, prefix: false)
|
@@ -9,7 +9,7 @@ module Comee
|
|
9
9
|
validates :valid_from, :valid_to, :price, :status, presence: true
|
10
10
|
validates :price, numericality: {greater_than: 0}
|
11
11
|
validates :discount, presence: true, numericality: {greater_than_or_equal_to: 0, less_than_or_equal_to: 100}
|
12
|
-
validates :product_id, uniqueness: {scope: [
|
12
|
+
validates :product_id, uniqueness: {scope: %i[client_id previous_price_id]}
|
13
13
|
validate :validate_price_validity_dates
|
14
14
|
|
15
15
|
def validate_price_validity_dates
|
@@ -19,11 +19,11 @@ module Comee
|
|
19
19
|
errors.add(:base, "Price validity date range is not correct.") unless period.valid?
|
20
20
|
end
|
21
21
|
|
22
|
-
def self.ransackable_attributes(
|
23
|
-
[
|
22
|
+
def self.ransackable_attributes(_auth_object = nil)
|
23
|
+
%w[valid_from valid_to price status product_id client_id previous_price_id]
|
24
24
|
end
|
25
25
|
|
26
|
-
def self.ransackable_associations(
|
26
|
+
def self.ransackable_associations(_auth_object = nil)
|
27
27
|
[]
|
28
28
|
end
|
29
29
|
end
|
@@ -23,20 +23,20 @@ module Comee
|
|
23
23
|
self.total_price += additional_charges
|
24
24
|
end
|
25
25
|
|
26
|
-
def self.ransackable_attributes(
|
27
|
-
[
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
26
|
+
def self.ransackable_attributes(_auth_object = nil)
|
27
|
+
%w[
|
28
|
+
sales_order_id
|
29
|
+
invoice_no
|
30
|
+
date_issued
|
31
|
+
ship_name
|
32
|
+
delivery_date
|
33
|
+
voyage_no
|
34
|
+
status
|
35
|
+
payment_status
|
36
36
|
]
|
37
37
|
end
|
38
38
|
|
39
|
-
def self.ransackable_associations(
|
39
|
+
def self.ransackable_associations(_auth_object = nil)
|
40
40
|
["sales_order"]
|
41
41
|
end
|
42
42
|
end
|
@@ -8,13 +8,13 @@ module Comee
|
|
8
8
|
|
9
9
|
validates :purchase_price, :status, :selling_price, :pp_valid_from, :pp_valid_to, :sp_valid_from, :sp_valid_to, presence: true
|
10
10
|
validates :margin, presence: true, numericality: {greater_than_or_equal_to: 0, less_than_or_equal_to: 100}
|
11
|
-
validates :product_id, uniqueness: {scope: [
|
11
|
+
validates :product_id, uniqueness: {scope: %i[supplier_id previous_price_id]}
|
12
12
|
validate :validate_primary_price, :validate_purchase_price_validity_dates, :validate_selling_price_validity_dates
|
13
13
|
|
14
14
|
def validate_primary_price
|
15
15
|
return unless product && primary
|
16
16
|
|
17
|
-
count = MasterPrice.where(product
|
17
|
+
count = MasterPrice.where(product: product, primary: true, active: true).count
|
18
18
|
errors.add(:base, "There is already a primary supplier for item '#{product.code}'") if count.positive?
|
19
19
|
end
|
20
20
|
|
@@ -32,14 +32,12 @@ module Comee
|
|
32
32
|
end
|
33
33
|
|
34
34
|
metadata.each do |k, v|
|
35
|
-
if v.class.to_s.downcase != properties[k]["type"]
|
36
|
-
errors.add(:metadata, "contains invalid value for field #{k}.")
|
37
|
-
end
|
35
|
+
errors.add(:metadata, "contains invalid value for field #{k}.") if v.class.to_s.downcase != properties[k]["type"]
|
38
36
|
if properties[k].key?("min") && v < properties[k]["min"]
|
39
|
-
errors.add(:base, "The value of #{k} cannot be lower than #{properties[k][
|
37
|
+
errors.add(:base, "The value of #{k} cannot be lower than #{properties[k]['min']}.")
|
40
38
|
end
|
41
39
|
if properties[k].key?("max") && v > properties[k]["max"]
|
42
|
-
errors.add(:base, "The value of #{k} cannot be higher than #{properties[k][
|
40
|
+
errors.add(:base, "The value of #{k} cannot be higher than #{properties[k]['max']}.")
|
43
41
|
end
|
44
42
|
end
|
45
43
|
end
|
@@ -9,10 +9,10 @@ module Comee
|
|
9
9
|
validates :order_number, presence: true, uniqueness: true
|
10
10
|
validates :order_date, :expected_delivery_date, :delivery_address, :invoice_address, :status, presence: true
|
11
11
|
validates :payment_no_of_days,
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
:payment_discount,
|
13
|
+
:payment_penalty,
|
14
|
+
presence: true,
|
15
|
+
numericality: {greater_than_or_equal_to: 0, less_than_or_equal_to: 100}
|
16
16
|
|
17
17
|
delegate(:name, to: :client, prefix: true)
|
18
18
|
|
@@ -30,19 +30,19 @@ module Comee
|
|
30
30
|
save
|
31
31
|
end
|
32
32
|
|
33
|
-
def self.ransackable_attributes(
|
34
|
-
[
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
33
|
+
def self.ransackable_attributes(_auth_object = nil)
|
34
|
+
%w[
|
35
|
+
delivery_address
|
36
|
+
expected_delivery_date
|
37
|
+
invoice_address
|
38
|
+
order_date
|
39
|
+
order_number
|
40
|
+
status
|
41
|
+
client_id
|
42
42
|
]
|
43
43
|
end
|
44
44
|
|
45
|
-
def self.ransackable_associations(
|
45
|
+
def self.ransackable_associations(_auth_object = nil)
|
46
46
|
[]
|
47
47
|
end
|
48
48
|
end
|
@@ -22,9 +22,9 @@ module Comee
|
|
22
22
|
|
23
23
|
def update_quantity_remaining
|
24
24
|
self.quantity_remaining = quantity
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
return unless quantity_en_route_changed? && quantity_en_route_was.positive? && quantity_en_route.zero?
|
26
|
+
|
27
|
+
self.quantity_remaining -= quantity_en_route_was
|
28
28
|
end
|
29
29
|
|
30
30
|
def update_quantity_en_route(quantity)
|
@@ -16,10 +16,10 @@ module Comee
|
|
16
16
|
|
17
17
|
def update_inventory(product_id, quantity_change)
|
18
18
|
inventory = Inventory.find_by(product_id: product_id)
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
return unless inventory
|
20
|
+
|
21
|
+
inventory.quantity -= quantity_change
|
22
|
+
inventory.save
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -2,7 +2,7 @@ module Comee
|
|
2
2
|
module Core
|
3
3
|
class ProductSerializer < ActiveModel::Serializer
|
4
4
|
attributes :id, :code, :name, :description, :product_type_id, :metadata, :unit_code, :unit_name,
|
5
|
-
|
5
|
+
:product_type_code, :product_type_name
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
@@ -20,7 +20,7 @@ module Comee
|
|
20
20
|
raise(StandardError, error) if to.instance_of?(String) && to != ORGANIZATION
|
21
21
|
|
22
22
|
if from == ORGANIZATION
|
23
|
-
query = ProductLookup.joins(:product).find_by(product: {code:}, **to)
|
23
|
+
query = ProductLookup.joins(:product).find_by(product: {code: code}, **to)
|
24
24
|
return query.code
|
25
25
|
end
|
26
26
|
|
@@ -6,13 +6,13 @@ class CreateComeeCoreProducts < ActiveRecord::Migration[7.0]
|
|
6
6
|
t.string :description
|
7
7
|
t.jsonb :metadata
|
8
8
|
t.references :product_type,
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
null: false,
|
10
|
+
index: {name: "ccpt_on_ccp_indx"},
|
11
|
+
foreign_key: {to_table: :comee_core_product_types}
|
12
12
|
t.references :unit,
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
null: false,
|
14
|
+
index: {name: "unit_on_ccp_indx"},
|
15
|
+
foreign_key: {to_table: :comee_core_units}
|
16
16
|
|
17
17
|
t.timestamps
|
18
18
|
end
|
@@ -6,9 +6,9 @@ class CreateComeeCoreSuppliers < ActiveRecord::Migration[7.0]
|
|
6
6
|
t.string :address, null: false
|
7
7
|
t.string :locale, null: false, default: "en"
|
8
8
|
t.references :user,
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
null: true,
|
10
|
+
index: {name: "user_on_ccs_indx"},
|
11
|
+
foreign_key: {to_table: :comee_core_users}
|
12
12
|
|
13
13
|
t.timestamps
|
14
14
|
end
|
@@ -2,9 +2,9 @@ class CreateComeeCoreClients < ActiveRecord::Migration[7.0]
|
|
2
2
|
def change
|
3
3
|
create_table :comee_core_clients do |t|
|
4
4
|
t.references :user,
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
null: false,
|
6
|
+
index: {name: "user_on_ccc_indx"},
|
7
|
+
foreign_key: {to_table: :comee_core_users}
|
8
8
|
t.string :code, null: false
|
9
9
|
t.string :name, null: false
|
10
10
|
t.string :address, null: false
|
@@ -5,9 +5,9 @@ class CreateComeeCoreBackOrders < ActiveRecord::Migration[7.0]
|
|
5
5
|
t.date :order_date, null: false, default: -> { "CURRENT_DATE" }
|
6
6
|
t.date :delivery_date, null: false
|
7
7
|
t.references :supplier,
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
null: false,
|
9
|
+
index: {name: "supplier_on_ccbo_indx"},
|
10
|
+
foreign_key: {to_table: :comee_core_suppliers}
|
11
11
|
t.json :terms, null: false, default: {freight_terms: "FOB", currency: "EURO"}
|
12
12
|
t.string :delivery_address, null: false
|
13
13
|
t.string :invoice_address, null: false
|
@@ -2,13 +2,13 @@ class CreateComeeCoreBackOrderItems < ActiveRecord::Migration[7.0]
|
|
2
2
|
def change
|
3
3
|
create_table :comee_core_back_order_items do |t|
|
4
4
|
t.references :back_order,
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
null: false,
|
6
|
+
index: {name: "bo_on_ccboi_indx"},
|
7
|
+
foreign_key: {to_table: :comee_core_back_orders}
|
8
8
|
t.references :product,
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
null: false,
|
10
|
+
index: {name: "product_on_ccboi_indx"},
|
11
|
+
foreign_key: {to_table: :comee_core_products}
|
12
12
|
t.float :requested_quantity, null: false
|
13
13
|
t.float :requested_unit_price, null: false
|
14
14
|
t.float :supplier_quantity, null: false
|
@@ -5,9 +5,9 @@ class CreateComeeCoreSalesOrders < ActiveRecord::Migration[7.0]
|
|
5
5
|
t.date :order_date, null: false, default: -> { "CURRENT_DATE" }
|
6
6
|
t.date :expected_delivery_date, null: false
|
7
7
|
t.references :client,
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
null: false,
|
9
|
+
index: {name: "client_on_ccso_indx"},
|
10
|
+
foreign_key: {to_table: :comee_core_clients}
|
11
11
|
t.json :client_terms
|
12
12
|
t.integer :payment_no_of_days, null: false, default: 0
|
13
13
|
t.float :payment_discount, null: false, default: 0.0
|
@@ -2,13 +2,13 @@ class CreateComeeCoreSalesOrderItems < ActiveRecord::Migration[7.0]
|
|
2
2
|
def change
|
3
3
|
create_table :comee_core_sales_order_items do |t|
|
4
4
|
t.references :sales_order,
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
null: false,
|
6
|
+
index: {name: "co_on_coi_indx"},
|
7
|
+
foreign_key: {to_table: :comee_core_sales_orders}
|
8
8
|
t.references :product,
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
null: false,
|
10
|
+
index: {name: "po_on_coi_indx"},
|
11
|
+
foreign_key: {to_table: :comee_core_products}
|
12
12
|
t.integer :quantity, null: false
|
13
13
|
t.integer :price, null: false
|
14
14
|
t.date :delivery_date, null: false
|
@@ -12,23 +12,23 @@ class CreateComeeCoreMasterPrices < ActiveRecord::Migration[7.0]
|
|
12
12
|
t.boolean :primary, null: false
|
13
13
|
t.integer :margin, null: false
|
14
14
|
t.references :product,
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
null: false,
|
16
|
+
index: {name: "product_on_ccsp_indx"},
|
17
|
+
foreign_key: {to_table: :comee_core_products}
|
18
18
|
t.references :supplier,
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
null: false,
|
20
|
+
index: {name: "supplier_on_ccsp_indx"},
|
21
|
+
foreign_key: {to_table: :comee_core_suppliers}
|
22
22
|
t.references :previous_price,
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
null: true,
|
24
|
+
index: {name: "previous_price_on_ccsp_indx"},
|
25
|
+
foreign_key: {to_table: :comee_core_master_prices}
|
26
26
|
|
27
27
|
t.timestamps
|
28
28
|
end
|
29
29
|
add_index :comee_core_master_prices,
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
%i[product_id supplier_id previous_price_id],
|
31
|
+
unique: true,
|
32
|
+
name: "pi_si_ppi_on_ccmp_indx"
|
33
33
|
end
|
34
34
|
end
|
@@ -7,23 +7,23 @@ class CreateComeeCoreClientPrices < ActiveRecord::Migration[7.0]
|
|
7
7
|
t.float :status, null: false, default: 0
|
8
8
|
t.integer :discount, null: false
|
9
9
|
t.references :product,
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
null: false,
|
11
|
+
index: {name: "product_on_cccp_indx"},
|
12
|
+
foreign_key: {to_table: :comee_core_products}
|
13
13
|
t.references :client,
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
null: false,
|
15
|
+
index: {name: "client_on_cccp_indx"},
|
16
|
+
foreign_key: {to_table: :comee_core_clients}
|
17
17
|
t.references :previous_price,
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
null: true,
|
19
|
+
index: {name: "previous_price_on_cccp_indx"},
|
20
|
+
foreign_key: {to_table: :comee_core_client_prices}
|
21
21
|
|
22
22
|
t.timestamps
|
23
23
|
end
|
24
24
|
add_index :comee_core_client_prices,
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
%i[product_id client_id previous_price_id],
|
26
|
+
unique: true,
|
27
|
+
name: "pi_ci_ppi_on_cccp_indx"
|
28
28
|
end
|
29
29
|
end
|
@@ -4,15 +4,15 @@ class CreateComeeCoreExternalProducts < ActiveRecord::Migration[7.0]
|
|
4
4
|
t.string :code, null: false
|
5
5
|
t.references :itemable, polymorphic: true, null: false
|
6
6
|
t.references :product,
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
null: false,
|
8
|
+
index: {name: "product_on_ccep_indx"},
|
9
|
+
foreign_key: {to_table: :comee_core_products}
|
10
10
|
|
11
11
|
t.timestamps
|
12
12
|
end
|
13
13
|
add_index :comee_core_product_lookups,
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
%i[itemable_id itemable_type product_id],
|
15
|
+
name: "itemable_product_indx_uniq",
|
16
|
+
unique: true
|
17
17
|
end
|
18
18
|
end
|
@@ -3,9 +3,9 @@ class CreateComeeCoreInvoices < ActiveRecord::Migration[7.0]
|
|
3
3
|
create_table :comee_core_invoices do |t|
|
4
4
|
t.string :invoice_no, null: false
|
5
5
|
t.references :sales_order,
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
null: false,
|
7
|
+
index: {name: "co_on_cci_indx"},
|
8
|
+
foreign_key: {to_table: :comee_core_sales_orders}
|
9
9
|
t.date :date_issued, null: false
|
10
10
|
t.string :ship_name
|
11
11
|
t.date :delivery_date
|
@@ -2,16 +2,16 @@ class CreateComeeCoreInvoiceItems < ActiveRecord::Migration[7.0]
|
|
2
2
|
def change
|
3
3
|
create_table :comee_core_invoice_items do |t|
|
4
4
|
t.references :sales_order_item,
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
null: false,
|
6
|
+
index: {name: "soi_on_ccii_indx"},
|
7
|
+
foreign_key: {to_table: :comee_core_sales_order_items}
|
8
8
|
t.float :quantity, null: false
|
9
9
|
t.float :unit_price, null: false
|
10
10
|
t.float :total_price, null: false
|
11
11
|
t.references :invoice,
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
null: false,
|
13
|
+
index: {name: "invoice_on_ccii_indx"},
|
14
|
+
foreign_key: {to_table: :comee_core_invoices}
|
15
15
|
|
16
16
|
t.timestamps
|
17
17
|
end
|
@@ -5,9 +5,9 @@ class CreateComeeCoreFieldMappings < ActiveRecord::Migration[7.0]
|
|
5
5
|
t.string :destination, null: false
|
6
6
|
t.integer :level, null: false, default: 0
|
7
7
|
t.references :order_source,
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
null: false,
|
9
|
+
index: {name: "order_source_on_cfm_indx"},
|
10
|
+
foreign_key: {to_table: :comee_core_order_sources}
|
11
11
|
|
12
12
|
t.timestamps
|
13
13
|
end
|
@@ -2,15 +2,15 @@ class CreateComeeCoreClientOrders < ActiveRecord::Migration[7.0]
|
|
2
2
|
def change
|
3
3
|
create_table :comee_core_client_orders do |t|
|
4
4
|
t.references :order_source,
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
null: false,
|
6
|
+
index: {name: "order_source_on_ccco_indx"},
|
7
|
+
foreign_key: {to_table: :comee_core_order_sources}
|
8
8
|
t.string :url, null: false
|
9
9
|
t.boolean :processed, null: false, default: true
|
10
10
|
t.references :client,
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
null: false,
|
12
|
+
index: {name: "client_on_ccco_indx"},
|
13
|
+
foreign_key: {to_table: :comee_core_clients}
|
14
14
|
|
15
15
|
t.timestamps
|
16
16
|
end
|
@@ -2,9 +2,9 @@ class CreateComeeCoreInventories < ActiveRecord::Migration[7.0]
|
|
2
2
|
def change
|
3
3
|
create_table :comee_core_inventories do |t|
|
4
4
|
t.references :product,
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
null: false,
|
6
|
+
index: {name: "product_on_cci_indx"},
|
7
|
+
foreign_key: {to_table: :comee_core_products}
|
8
8
|
t.integer :quantity, null: false
|
9
9
|
|
10
10
|
t.timestamps
|
@@ -5,9 +5,9 @@ class CreateComeeCoreWarehouseShipments < ActiveRecord::Migration[7.0]
|
|
5
5
|
t.string :destination, null: false
|
6
6
|
t.date :delivery_date, null: false
|
7
7
|
t.references :client,
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
null: false,
|
9
|
+
index: {name: "client_on_ccws_indx"},
|
10
|
+
foreign_key: {to_table: :comee_core_clients}
|
11
11
|
t.integer :status, null: false, default: 0
|
12
12
|
|
13
13
|
t.timestamps
|
@@ -2,13 +2,13 @@ class CreateComeeCoreWarehouseShipmentItems < ActiveRecord::Migration[7.0]
|
|
2
2
|
def change
|
3
3
|
create_table :comee_core_warehouse_shipment_items do |t|
|
4
4
|
t.references :warehouse_shipment,
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
null: false,
|
6
|
+
index: {name: "ws_on_ccwsi_indx"},
|
7
|
+
foreign_key: {to_table: :comee_core_warehouse_shipments}
|
8
8
|
t.references :sales_order_item,
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
null: false,
|
10
|
+
index: {name: "soi_on_ccwsi_indx"},
|
11
|
+
foreign_key: {to_table: :comee_core_sales_order_items}
|
12
12
|
t.integer :quantity, null: false
|
13
13
|
|
14
14
|
t.timestamps
|
data/lib/comee/core/engine.rb
CHANGED
@@ -15,9 +15,7 @@ module Comee
|
|
15
15
|
end
|
16
16
|
|
17
17
|
initializer :append_migrations do |app|
|
18
|
-
unless app.root.to_s.match(root.to_s + File::SEPARATOR)
|
19
|
-
app.config.paths["db/migrate"].concat(config.paths["db/migrate"].expanded)
|
20
|
-
end
|
18
|
+
app.config.paths["db/migrate"].concat(config.paths["db/migrate"].expanded) unless app.root.to_s.match(root.to_s + File::SEPARATOR)
|
21
19
|
end
|
22
20
|
end
|
23
21
|
end
|
data/lib/comee/core/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
@@ -123,7 +123,7 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: letter_opener
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
@@ -137,7 +137,7 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: rspec-rails
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - ">="
|
@@ -151,7 +151,7 @@ dependencies:
|
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
154
|
+
name: shoulda-matchers
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - ">="
|
@@ -165,7 +165,7 @@ dependencies:
|
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
168
|
+
name: simplecov
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
171
|
- - ">="
|
@@ -179,7 +179,7 @@ dependencies:
|
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
|
-
name:
|
182
|
+
name: solargraph
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
185
|
- - ">="
|
@@ -193,7 +193,7 @@ dependencies:
|
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
|
-
name:
|
196
|
+
name: spring
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
199
|
- - ">="
|
@@ -207,21 +207,7 @@ dependencies:
|
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
|
-
name:
|
211
|
-
requirement: !ruby/object:Gem::Requirement
|
212
|
-
requirements:
|
213
|
-
- - ">="
|
214
|
-
- !ruby/object:Gem::Version
|
215
|
-
version: 1.30.1
|
216
|
-
type: :development
|
217
|
-
prerelease: false
|
218
|
-
version_requirements: !ruby/object:Gem::Requirement
|
219
|
-
requirements:
|
220
|
-
- - ">="
|
221
|
-
- !ruby/object:Gem::Version
|
222
|
-
version: 1.30.1
|
223
|
-
- !ruby/object:Gem::Dependency
|
224
|
-
name: letter_opener
|
210
|
+
name: spring-commands-rspec
|
225
211
|
requirement: !ruby/object:Gem::Requirement
|
226
212
|
requirements:
|
227
213
|
- - ">="
|
@@ -370,7 +356,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
370
356
|
requirements:
|
371
357
|
- - ">="
|
372
358
|
- !ruby/object:Gem::Version
|
373
|
-
version: '0'
|
359
|
+
version: '3.0'
|
374
360
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
375
361
|
requirements:
|
376
362
|
- - ">="
|