snf_core 0.1.1 → 0.2.0

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: e706a0de02b2c44b1913d7fd47d5931ae8b5f2250d682ff938d4db8e8b0e1222
4
- data.tar.gz: 53f5314b9d72ef1342682049c558599d19e074246624faabad0f7b79a8c33cfb
3
+ metadata.gz: 122d529289ccf8b90e6254c1f8aed2c1171fe41fdbf94c40ba2c64d026693586
4
+ data.tar.gz: d6543e1461630e153501892f2209b34d5960332f0aaaace71d837a32a4f8f923
5
5
  SHA512:
6
- metadata.gz: c923f81889c9fbef76b58739e05e6d0d3932913773afc4cb4916f541a39572def642e9fd1f8ed39d46303ae4e8f76479a1a3481ad681ebf521608f3391246977
7
- data.tar.gz: c36e526761bc3b6f94fc90d5bf24b5551e6118847f929548a70b374ca777151a96d45c8fde0fb9e5b1cbda39e7f193d328b79213b1914e042984849847f060b8
6
+ metadata.gz: ec7bef961a04963418783f211a3c8c3658c517de69e9ad00412be8b9e0e7c6073420c3ce54ffac1ff38f2ad6546a3aca9e5b649579abbb712601a6cb1cea27c5
7
+ data.tar.gz: 55a71a7e898c8965fb50df6c10ec2c88409585ed1cc0e9049d89e32cc263d84cb545f98e540eb391c8c7f5d9e2c813c5114bd4ebf4c5ab2d6d6624b515426784
@@ -0,0 +1,6 @@
1
+ module SnfCore
2
+ class Address < ApplicationRecord
3
+ validates :address_type, :city, :sub_city, :latitude, :longitude, presence: true
4
+ validates :longitude, :latitude, numericality: true
5
+ end
6
+ end
@@ -0,0 +1,11 @@
1
+ module SnfCore
2
+ class Business < ApplicationRecord
3
+ belongs_to :user
4
+
5
+ validates :business_name, :tin_number, :business_type, :verification_status, presence: true
6
+ validates :tin_number, uniqueness: true
7
+
8
+ enum :business_type, { retailer: 0, wholesaler: 1 }
9
+ enum :verification_status, { pending: 0, approved: 1, rejected: 2 }
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ module SnfCore
2
+ class BusinessDocument < ApplicationRecord
3
+ belongs_to :business
4
+ belongs_to :verified_by, class_name: "SnfCore::User", optional: true
5
+
6
+ enum :document_type, { business_license: 0, representative_id: 1 }
7
+
8
+ has_one_attached :document
9
+
10
+ validates :document_type, :uploaded_at, :document, presence: true
11
+ end
12
+ end
@@ -0,0 +1,7 @@
1
+ module SnfCore
2
+ class Category < ApplicationRecord
3
+ belongs_to :parent, optional: true, class_name: "SnfCore::Category"
4
+
5
+ validates :name, presence: true, uniqueness: true
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ module SnfCore
2
+ class CustomerGroup < ApplicationRecord
3
+ belongs_to :group
4
+ belongs_to :customer, class_name: "SnfCore::User"
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ module SnfCore
2
+ class Group < ApplicationRecord
3
+ belongs_to :business
4
+
5
+ validates :name, presence: true
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ module SnfCore
2
+ class Product < ApplicationRecord
3
+ belongs_to :category
4
+
5
+ has_one_attached :thumbnail_image
6
+ has_many_attached :images
7
+
8
+ validates :name, presence: true
9
+ validates :sku, presence: true, uniqueness: true
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ module SnfCore
2
+ class Store < ApplicationRecord
3
+ belongs_to :business
4
+ belongs_to :address
5
+
6
+ validates :name, :operational_status, presence: true
7
+
8
+ enum :operational_status, { in_active: 0, active: 1 }
9
+ end
10
+ end
@@ -0,0 +1,6 @@
1
+ module SnfCore
2
+ class StoreInventory < ApplicationRecord
3
+ belongs_to :store
4
+ belongs_to :product
5
+ end
6
+ end
@@ -0,0 +1,11 @@
1
+ class CreateSnfCoreCategories < ActiveRecord::Migration[8.0]
2
+ def change
3
+ create_table :snf_core_categories do |t|
4
+ t.string :name, null: false
5
+ t.string :description
6
+ t.references :parent, null: true, foreign_key: { to_table: :snf_core_categories }
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ class CreateSnfCoreBusinesses < ActiveRecord::Migration[8.0]
2
+ def change
3
+ create_table :snf_core_businesses do |t|
4
+ t.references :user, null: false, foreign_key: { to_table: :snf_core_users }
5
+ t.string :business_name, null: false
6
+ t.string :tin_number, null: false
7
+ t.integer :business_type, null: false
8
+ t.datetime :verified_at
9
+ t.integer :verification_status, null: false
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ class CreateSnfCoreBusinessDocuments < ActiveRecord::Migration[8.0]
2
+ def change
3
+ create_table :snf_core_business_documents do |t|
4
+ t.references :business, null: false, foreign_key: { to_table: :snf_core_businesses }
5
+ t.integer :document_type, null: false
6
+ t.datetime :verified_at
7
+ t.references :verified_by, foreign_key: { to_table: :snf_core_users }, null: true
8
+ t.datetime :uploaded_at
9
+ t.boolean :is_verified, null: false, default: false
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ class CreateSnfCoreAddresses < ActiveRecord::Migration[8.0]
2
+ def change
3
+ create_table :snf_core_addresses do |t|
4
+ t.string :address_type, null: false
5
+ t.string :city, null: false
6
+ t.string :sub_city, null: false
7
+ t.string :woreda
8
+ t.decimal :latitude, null: false
9
+ t.decimal :longitude, null: false
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ class CreateSnfCoreStores < ActiveRecord::Migration[8.0]
2
+ def change
3
+ create_table :snf_core_stores do |t|
4
+ t.string :name, null: false
5
+ t.string :email
6
+ t.integer :operational_status, null: false, default: 1
7
+ t.references :business, null: false, foreign_key: { to_table: :snf_core_businesses }
8
+ t.references :address, null: false, foreign_key: { to_table: :snf_core_addresses }
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ class CreateSnfCoreProducts < ActiveRecord::Migration[8.0]
2
+ def change
3
+ create_table :snf_core_products do |t|
4
+ t.string :sku, null: false
5
+ t.string :name, null: false
6
+ t.string :description
7
+ t.references :category, null: false, foreign_key: { to_table: :snf_core_categories }
8
+ t.float :base_price
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ class CreateSnfCoreStoreInventories < ActiveRecord::Migration[8.0]
2
+ def change
3
+ create_table :snf_core_store_inventories do |t|
4
+ t.string :stock_quantity
5
+ t.float :reorder_level
6
+ t.datetime :last_restocked_at
7
+ t.references :store, null: false, foreign_key: { to_table: :snf_core_stores }
8
+ t.references :product, null: false, foreign_key: { to_table: :snf_core_products }
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,10 @@
1
+ class CreateSnfCoreGroups < ActiveRecord::Migration[8.0]
2
+ def change
3
+ create_table :snf_core_groups do |t|
4
+ t.string :name, null: false
5
+ t.references :business, null: false, foreign_key: { to_table: :snf_core_businesses }
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,13 @@
1
+ class CreateSnfCoreCustomerGroups < ActiveRecord::Migration[8.0]
2
+ def change
3
+ create_table :snf_core_customer_groups do |t|
4
+ t.string :discount_code
5
+ t.datetime :expire_date
6
+ t.boolean :is_used
7
+ t.references :group, null: false, foreign_key: { to_table: :snf_core_groups }
8
+ t.references :customer, null: false, foreign_key: { to_table: :snf_core_users }
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -18,5 +18,7 @@ module SnfCore
18
18
  app.config.paths["db/migrate"].concat(config.paths["db/migrate"].expanded)
19
19
  end
20
20
  end
21
+
22
+ require "active_storage/engine"
21
23
  end
22
24
  end
@@ -1,3 +1,3 @@
1
1
  module SnfCore
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snf_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Asrat
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-02-26 00:00:00.000000000 Z
10
+ date: 2025-02-27 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: active_model_serializers
@@ -288,10 +288,28 @@ files:
288
288
  - app/controllers/snf_core/application_controller.rb
289
289
  - app/jobs/snf_core/application_job.rb
290
290
  - app/mailers/snf_core/application_mailer.rb
291
+ - app/models/snf_core/address.rb
291
292
  - app/models/snf_core/application_record.rb
293
+ - app/models/snf_core/business.rb
294
+ - app/models/snf_core/business_document.rb
295
+ - app/models/snf_core/category.rb
296
+ - app/models/snf_core/customer_group.rb
297
+ - app/models/snf_core/group.rb
298
+ - app/models/snf_core/product.rb
299
+ - app/models/snf_core/store.rb
300
+ - app/models/snf_core/store_inventory.rb
292
301
  - app/models/snf_core/user.rb
293
302
  - config/routes.rb
294
303
  - db/migrate/20250226042622_create_snf_core_users.rb
304
+ - db/migrate/20250226064444_create_snf_core_categories.rb
305
+ - db/migrate/20250226080323_create_snf_core_businesses.rb
306
+ - db/migrate/20250226102931_create_snf_core_business_documents.rb
307
+ - db/migrate/20250226110217_create_snf_core_addresses.rb
308
+ - db/migrate/20250226115215_create_snf_core_stores.rb
309
+ - db/migrate/20250226181007_create_snf_core_products.rb
310
+ - db/migrate/20250226190655_create_snf_core_store_inventories.rb
311
+ - db/migrate/20250226192104_create_snf_core_groups.rb
312
+ - db/migrate/20250226193938_create_snf_core_customer_groups.rb
295
313
  - lib/snf_core.rb
296
314
  - lib/snf_core/engine.rb
297
315
  - lib/snf_core/version.rb