snf_core 0.3.7 → 0.3.8
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/snf_core/auth_controller.rb +3 -2
- data/app/models/snf_core/quotation.rb +1 -0
- data/db/migrate/20250317135148_add_user_to_quotation.rb +5 -0
- data/lib/snf_core/version.rb +1 -1
- data/spec/dummy/db/schema.rb +4 -1
- data/spec/dummy/log/development.log +793 -0
- data/spec/dummy/log/test.log +16055 -0
- data/spec/dummy/tmp/storage/4b/jj/4bjj0gif47zey9wtfgchqycn1yvf +0 -0
- data/spec/dummy/tmp/storage/4p/en/4peng35m86rx8tqpyj6ekabtkby8 +0 -0
- data/spec/dummy/tmp/storage/5m/ym/5mymeg6xe9jzbmzzlgeuc9cpfc7p +0 -0
- data/spec/dummy/tmp/storage/74/qy/74qyz5a03ozsho4l4fb1qmcd1iyl +0 -0
- data/spec/dummy/tmp/storage/7f/1u/7f1u3qgbmbvx18taa0zeyeau19tv +0 -0
- data/spec/dummy/tmp/storage/cf/cn/cfcnhpfk26n7siiezv2v1ooo7m2w +0 -0
- data/spec/dummy/tmp/storage/cz/gv/czgv4l1kemyizmlq3975u364pppi +0 -0
- data/spec/dummy/tmp/storage/f3/33/f333obc6vddqvdsbesykcpxm41y5 +0 -0
- data/spec/dummy/tmp/storage/gt/9z/gt9zc94cxlddgqpgomo30vjjihky +0 -0
- data/spec/dummy/tmp/storage/iq/z5/iqz5993sf7hx44dprnqqpc2b7n52 +0 -0
- data/spec/dummy/tmp/storage/iy/3r/iy3rwasm8e6s4z3wmhnwwmo7w9sz +0 -0
- data/spec/dummy/tmp/storage/ny/o3/nyo3lmyjvneit4ame6w4f3ruhnkp +0 -0
- data/spec/dummy/tmp/storage/od/wq/odwqixsz0iqwah8tm7eggdxyvsob +0 -0
- data/spec/dummy/tmp/storage/pu/t5/put5ap86ooxqmifj7mi0niu507l8 +0 -0
- data/spec/dummy/tmp/storage/qd/5o/qd5oes7453z8e5mizm5e2f3zxuiz +0 -0
- data/spec/examples.txt +202 -201
- data/spec/factories/snf_core/quotations.rb +1 -0
- data/spec/models/snf_core/quotation_spec.rb +1 -0
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6089c70b25e81c76d4256e296c173865d35a1719516a5b31f6df20f6da7d603
|
4
|
+
data.tar.gz: 6df324619449910eaea298462ed5c5cf85bf54531681c974b73c8ab126508392
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 075272f56cad453bd1267d0ed084adf61eb1e04460ecb09051841c0bbed5cbc58c5908d0113faba2eee7b874c08234ac1d18cff5f5490c4f40c5c510400241af
|
7
|
+
data.tar.gz: e6e6c53d4acaa86abd536c056d5ba5909a1332197d690a686fef60b0f857c4c4c9cae00022527bed54372ef4192d2370dd63623e321c70f067c7d3dd51627e61
|
@@ -75,9 +75,10 @@ module SnfCore
|
|
75
75
|
return render json: { success: false, error: "Invalid email or password" }, status: :unauthorized unless user.authenticate(auth_params[:password])
|
76
76
|
user_role = UserRole.find_by(user: user)
|
77
77
|
return render json: { success: false, error: "No role was assigned to your user" }, status: :unauthorized unless user_role
|
78
|
-
|
78
|
+
address = SnfCore::User.find_by(address_id: user.address_id)
|
79
|
+
return render json: { success: false, error: "No address was assigned to your user" }, status: :unauthorized unless address
|
79
80
|
role = Role.find(user_role.role_id)
|
80
|
-
token = @token_service.encode({ user: user.as_json.except("password_digest", "created_at", "updated_at"), role: role.name })
|
81
|
+
token = @token_service.encode({ user: user.as_json.except("password_digest", "created_at", "updated_at"), role: role.name, address: address.as_json(except: [ :created_at, :updated_at ]) })
|
81
82
|
render json: { success: true, token: token, user: user.as_json(except: [ :password_digest ]), role: role.name }
|
82
83
|
end
|
83
84
|
|
data/lib/snf_core/version.rb
CHANGED
data/spec/dummy/db/schema.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
#
|
11
11
|
# It's strongly recommended that you check this file into your version control system.
|
12
12
|
|
13
|
-
ActiveRecord::Schema[8.0].define(version:
|
13
|
+
ActiveRecord::Schema[8.0].define(version: 2025_03_17_135148) do
|
14
14
|
# These are extensions that must be enabled in order to support this database
|
15
15
|
enable_extension "pg_catalog.plpgsql"
|
16
16
|
|
@@ -202,7 +202,9 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_13_103149) do
|
|
202
202
|
t.text "notes"
|
203
203
|
t.datetime "created_at", null: false
|
204
204
|
t.datetime "updated_at", null: false
|
205
|
+
t.bigint "user_id", null: false
|
205
206
|
t.index ["item_request_id"], name: "index_snf_core_quotations_on_item_request_id"
|
207
|
+
t.index ["user_id"], name: "index_snf_core_quotations_on_user_id"
|
206
208
|
end
|
207
209
|
|
208
210
|
create_table "snf_core_roles", force: :cascade do |t|
|
@@ -333,6 +335,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_13_103149) do
|
|
333
335
|
add_foreign_key "snf_core_orders", "snf_core_users", column: "user_id"
|
334
336
|
add_foreign_key "snf_core_products", "snf_core_categories", column: "category_id"
|
335
337
|
add_foreign_key "snf_core_quotations", "snf_core_item_requests", column: "item_request_id"
|
338
|
+
add_foreign_key "snf_core_quotations", "snf_core_users", column: "user_id"
|
336
339
|
add_foreign_key "snf_core_store_inventories", "snf_core_products", column: "product_id"
|
337
340
|
add_foreign_key "snf_core_store_inventories", "snf_core_stores", column: "store_id"
|
338
341
|
add_foreign_key "snf_core_stores", "snf_core_addresses", column: "address_id"
|