snf_core 0.1.0 → 0.1.2
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 +4 -4
- data/app/controllers/concerns/common.rb +4 -4
- data/app/models/snf_core/category.rb +7 -0
- data/app/models/snf_core/user.rb +8 -0
- data/db/migrate/20250226042622_create_snf_core_users.rb +14 -0
- data/db/migrate/20250226064444_create_snf_core_categories.rb +11 -0
- data/lib/snf_core/engine.rb +4 -4
- data/lib/snf_core/version.rb +1 -1
- metadata +5 -3
- data/app/models/snf_core/person.rb +0 -5
- data/db/migrate/20250226035137_create_snf_core_people.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bbdb9fc819f9aa25f6205f9dbab89513ac530866199ebc89f3d5da5641866b8
|
4
|
+
data.tar.gz: 4b8b29a62bb45e970ff61415dd130c1366c54625a99ecd34969d426af0742e82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 831b9ded43b06f7c2b2a2ed0d882db10d29d2e5485412a6d3a7a634226a2285383a25ec9f2fb87ecaf632a961da0a4ffa1cf86d9100960748a47fbec34dfd772
|
7
|
+
data.tar.gz: 19099f2135ab88e6799ec4971343fe5aafa2f799a769299347ee27591706aa55ab9093ab129687771dc9dd8aae2c1557af4832a460a4078c55fe75753a711597
|
@@ -84,10 +84,10 @@ module SnfCore
|
|
84
84
|
}
|
85
85
|
render json: result, status: :created
|
86
86
|
else
|
87
|
-
render json: {success: false, error: obj.errors.full_messages[0]}, status: 422
|
87
|
+
render json: { success: false, error: obj.errors.full_messages[0] }, status: 422
|
88
88
|
end
|
89
89
|
rescue StandardError => e
|
90
|
-
render json: {success: false, error: e.message}
|
90
|
+
render json: { success: false, error: e.message }
|
91
91
|
end
|
92
92
|
|
93
93
|
def update
|
@@ -114,10 +114,10 @@ module SnfCore
|
|
114
114
|
}
|
115
115
|
render json: result
|
116
116
|
else
|
117
|
-
render json: {success: false, error: obj.errors.full_messages[0]}, status: 422
|
117
|
+
render json: { success: false, error: obj.errors.full_messages[0] }, status: 422
|
118
118
|
end
|
119
119
|
rescue StandardError => e
|
120
|
-
render json: {success: false, error: e.message}
|
120
|
+
render json: { success: false, error: e.message }
|
121
121
|
end
|
122
122
|
|
123
123
|
private
|
@@ -0,0 +1,8 @@
|
|
1
|
+
module SnfCore
|
2
|
+
class User < ApplicationRecord
|
3
|
+
validates :first_name, :middle_name, :last_name, :phone_number, :role, presence: true
|
4
|
+
validates :phone_number, :email, uniqueness: true
|
5
|
+
|
6
|
+
enum :role, { admin: 0, wholesaler: 1, retailer: 2, consumer: 3 }
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateSnfCoreUsers < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :snf_core_users do |t|
|
4
|
+
t.string :first_name, null: false
|
5
|
+
t.string :middle_name, null: false
|
6
|
+
t.string :last_name, null: false
|
7
|
+
t.string :email
|
8
|
+
t.string :phone_number, null: false
|
9
|
+
t.integer :role, null: false
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
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
|
data/lib/snf_core/engine.rb
CHANGED
@@ -6,16 +6,16 @@ module SnfCore
|
|
6
6
|
config.generators do |g|
|
7
7
|
g.test_framework :rspec, routing_specs: false
|
8
8
|
g.fixture_replacement :factory_bot
|
9
|
-
g.factory_bot dir:
|
9
|
+
g.factory_bot dir: "spec/factories"
|
10
10
|
end
|
11
11
|
|
12
|
-
initializer
|
13
|
-
FactoryBot.definition_file_paths << File.expand_path(
|
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)
|
14
14
|
end
|
15
15
|
|
16
16
|
initializer :append_migrations do |app|
|
17
17
|
unless app.root.to_s.match(root.to_s + File::SEPARATOR)
|
18
|
-
app.config.paths[
|
18
|
+
app.config.paths["db/migrate"].concat(config.paths["db/migrate"].expanded)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
data/lib/snf_core/version.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Asrat
|
@@ -289,9 +289,11 @@ files:
|
|
289
289
|
- app/jobs/snf_core/application_job.rb
|
290
290
|
- app/mailers/snf_core/application_mailer.rb
|
291
291
|
- app/models/snf_core/application_record.rb
|
292
|
-
- app/models/snf_core/
|
292
|
+
- app/models/snf_core/category.rb
|
293
|
+
- app/models/snf_core/user.rb
|
293
294
|
- config/routes.rb
|
294
|
-
- db/migrate/
|
295
|
+
- db/migrate/20250226042622_create_snf_core_users.rb
|
296
|
+
- db/migrate/20250226064444_create_snf_core_categories.rb
|
295
297
|
- lib/snf_core.rb
|
296
298
|
- lib/snf_core/engine.rb
|
297
299
|
- lib/snf_core/version.rb
|