snf_core 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b148e772bedfc2369e9eb125c9e752f3f7519cb1ac47e5c365416e45fe549796
4
- data.tar.gz: 1bbb2accd13bc2f00ae5f4b6e55061ea54d47f563a99811c2594be72f4efb4c7
3
+ metadata.gz: 82a78e7e7fe7830d277d702448478779473aca40829b30e3d74c1554ba3d4dc1
4
+ data.tar.gz: 457974a653a89f8e649a44c848bc107981698075695b752e048765f2ace3c212
5
5
  SHA512:
6
- metadata.gz: 06a09af28f6ea76d7e2ccdf0ec82b620e0108fae243b399d734400cd37ff76f81acb7b44c64445dc4fa8988109fe8fc2a8203ccd90bd404d9e0e2d1a44b8ca3d
7
- data.tar.gz: e2650005be78578265bbbaaea8690d68efd8f1f87f63defef03554dbb36d95b79dd129b7c86897d95deac52250095d2ed95d0a24f545916797c50084db77d602
6
+ metadata.gz: 81c6afc9efc9aaefe702dc110f275604cadd9bef719442c35079aec3b95c49b87be3c2899f6ccd3e929970b3bbec71010a65fa4487fdc36d36b4a5ff3a84558d
7
+ data.tar.gz: 0c1cdbc7d820f8a591b0a3abab4b07d14eb7de4f7d9e892eab375e23c76bdc418df70fdb486800b19b08e35cf2839197cb9161f76f0872bfec814d3e0845f5df
@@ -3,19 +3,19 @@ module SnfCore
3
3
  belongs_to :store
4
4
  belongs_to :product
5
5
 
6
- validates :stock_quantity, presence: true, numericality: {
7
- only_integer: true,
8
- greater_than_or_equal_to: 0
6
+ enum :status, {
7
+ available: 0,
8
+ unavailable: 1
9
9
  }
10
+
11
+ validates :status, presence: true
12
+
10
13
  validates :base_price, presence: true, numericality: {
11
14
  greater_than_or_equal_to: 0
12
15
  }
13
16
 
14
17
  validate :unique_store_product_combination
15
18
 
16
- scope :out_of_stock, -> { where(stock_quantity: 0) }
17
- scope :in_stock, -> { where("stock_quantity > 0") }
18
-
19
19
  private
20
20
 
21
21
  def unique_store_product_combination
@@ -0,0 +1,7 @@
1
+ class ModifyStoreInventories < ActiveRecord::Migration[8.0]
2
+ def change
3
+ remove_column :snf_core_store_inventories, :stock_quantity, :integer
4
+
5
+ add_column :snf_core_store_inventories, :status, :integer, default: 0, null: false
6
+ end
7
+ end
@@ -10,7 +10,9 @@ module SnfCore
10
10
  end
11
11
 
12
12
  initializer "snf_core.factories", after: "factory_bot.set_factory_paths" do
13
- FactoryBot.definition_file_paths << File.expand_path("../../../spec/factories", __dir__) if defined?(FactoryBot)
13
+ spec_path = File.expand_path("../../spec", root)
14
+ FactoryBot.definition_file_paths << spec_path if defined?(FactoryBot)
15
+ FactoryBot.find_definitions if defined?(FactoryBot)
14
16
  end
15
17
 
16
18
  initializer :append_migrations do |app|
@@ -1,3 +1,3 @@
1
1
  module SnfCore
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snf_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Asrat
@@ -312,15 +312,16 @@ files:
312
312
  - db/migrate/20250226192104_create_snf_core_groups.rb
313
313
  - db/migrate/20250226193938_create_snf_core_customer_groups.rb
314
314
  - db/migrate/20250227075048_create_snf_core_wallets.rb
315
+ - db/migrate/20250227102833_modify_store_inventories.rb
315
316
  - lib/snf_core.rb
316
317
  - lib/snf_core/engine.rb
317
318
  - lib/snf_core/version.rb
318
319
  - lib/tasks/snf_core_tasks.rake
319
- homepage: https://www.mks.com
320
+ homepage: https://mksaddis.com/
320
321
  licenses:
321
322
  - MIT
322
323
  metadata:
323
- homepage_uri: https://www.mks.com
324
+ homepage_uri: https://mksaddis.com/
324
325
  source_code_uri: https://github.com/BITS-DEVSEC
325
326
  changelog_uri: https://github.com/BITS-DEVSEC
326
327
  rdoc_options: []