snf_core 0.2.98 → 0.3.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 +4 -4
- data/app/controllers/snf_core/auth_controller.rb +40 -14
- data/app/models/snf_core/quotation.rb +2 -2
- data/db/migrate/20250226110217_create_snf_core_addresses.rb +2 -2
- data/db/migrate/20250312043359_create_snf_core_quotations.rb +2 -2
- data/lib/snf_core/version.rb +1 -1
- data/spec/dummy/log/development.log +397 -0
- data/spec/dummy/log/test.log +26838 -0
- data/spec/dummy/tmp/pids/server.pid +1 -0
- data/spec/dummy/tmp/storage/3y/fu/3yfusxgm9k67dmwa3oo0pp8yzh1u +0 -0
- data/spec/dummy/tmp/storage/4t/g2/4tg25888ee5rj0ce7tkqbcayu3o6 +0 -0
- data/spec/dummy/tmp/storage/4w/8g/4w8gm78byspbg9u3knleahn6yep0 +0 -0
- data/spec/dummy/tmp/storage/5m/r3/5mr3d70rwav44966cmlzafropl6p +0 -0
- data/spec/dummy/tmp/storage/5z/u2/5zu2fkv6tm01qppyyuik90qr4bug +0 -0
- data/spec/dummy/tmp/storage/7w/hv/7whvwq4ot5uwt3k1h5ipc4xtvk36 +0 -0
- data/spec/dummy/tmp/storage/a7/00/a700gfeervmzu9mw05rhvbnjx8da +0 -0
- data/spec/dummy/tmp/storage/c0/mt/c0mtlkx0368uvpzfgmd38syzoy2v +0 -0
- data/spec/dummy/tmp/storage/cr/ny/crnyduu73jm6jtqt2cbq1dz3x8gr +0 -0
- data/spec/dummy/tmp/storage/dm/xj/dmxjedfmoojuhgwpb9gjveuqyki7 +0 -0
- data/spec/dummy/tmp/storage/dn/m1/dnm1qr855gwf7ppy7sft1dxgsnfd +0 -0
- data/spec/dummy/tmp/storage/fx/08/fx08ebmlikk1qd57t92stc1hdbda +0 -0
- data/spec/dummy/tmp/storage/gm/ar/gmarwjxd7y7bzebx8atz41yffhjx +0 -0
- data/spec/dummy/tmp/storage/h6/un/h6undns4303m8l8ft0pkffjiren6 +0 -0
- data/spec/dummy/tmp/storage/mx/lo/mxloqbggy6drma5ov1998tgrkman +0 -0
- data/spec/dummy/tmp/storage/qc/vv/qcvvq3ncfl03yp4pc18jyreg8boz +0 -0
- data/spec/dummy/tmp/storage/t3/tj/t3tj5uirsnvxchyl1hho04dmh49t +0 -0
- data/spec/dummy/tmp/storage/td/9t/td9t86soc5nypxfis5tqyp5pcx9x +0 -0
- data/spec/dummy/tmp/storage/tj/e8/tje84os9t9sr081jgbxri4qvi13j +0 -0
- data/spec/dummy/tmp/storage/u4/cv/u4cvbf3g5ev4vi4ce3j9lsmrpipj +0 -0
- data/spec/dummy/tmp/storage/uw/cb/uwcbklmtksvymz23ijjgkiup5o2e +0 -0
- data/spec/dummy/tmp/storage/w9/u9/w9u9utltwus816bm8iznc1e3pprl +0 -0
- data/spec/dummy/tmp/storage/wg/o9/wgo9a559sc4bub8phdnkxtupnozr +0 -0
- data/spec/dummy/tmp/storage/wv/61/wv61b1fuar05sjp9q0cnx58xplnh +0 -0
- data/spec/dummy/tmp/storage/y5/xu/y5xuawt4vxn5vmwzruc3juv1bqk4 +0 -0
- data/spec/examples.txt +197 -197
- data/spec/models/snf_core/quotation_spec.rb +0 -2
- data/spec/requests/snf_core/auth_spec.rb +18 -9
- metadata +27 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f22dd66f3a5b0d74ae9e2861c4e700fbe07526eec275c51943eb701451d92e1f
|
4
|
+
data.tar.gz: 33c322e0e4c72983d9ce4ff027861b74299a9cd13a8b6e2ac80a2cb034441bde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4c0d27b9b9f687699e1ae64e6fbf469ca351b75d632399ad3ea9cdc316ba8cf7b07206bde77d997a1e800320cd018a928a7768b4bf3adb817836ba2baa16bd3
|
7
|
+
data.tar.gz: 4e45106323c448eb148cb21affb9f81f7bd88d2909bfb2c38a035f092c490842515d510486806c4458090c3d100f570ee258571278e954adf8960cc2ba5daf60
|
@@ -4,24 +4,39 @@ module SnfCore
|
|
4
4
|
|
5
5
|
def signup
|
6
6
|
ActiveRecord::Base.transaction do
|
7
|
-
@
|
7
|
+
@address = Address.new(address_params)
|
8
8
|
|
9
|
-
if @
|
10
|
-
@
|
11
|
-
|
12
|
-
business_name: signup_params[:business_name],
|
13
|
-
tin_number: signup_params[:tin_number],
|
14
|
-
business_type: signup_params[:business_type],
|
15
|
-
)
|
9
|
+
if @address.save
|
10
|
+
@user = User.new(user_params)
|
11
|
+
@user.address = @address
|
16
12
|
|
17
|
-
if @
|
18
|
-
|
13
|
+
if @user.save
|
14
|
+
@business = Business.new(
|
15
|
+
user: @user,
|
16
|
+
business_name: signup_params[:business_name],
|
17
|
+
tin_number: signup_params[:tin_number],
|
18
|
+
business_type: signup_params[:business_type]
|
19
|
+
)
|
20
|
+
|
21
|
+
if @business.save
|
22
|
+
render json: {
|
23
|
+
success: true,
|
24
|
+
user: @user.as_json(except: [ :password_digest ]),
|
25
|
+
business: @business,
|
26
|
+
address: @address
|
27
|
+
}, status: :created
|
28
|
+
return
|
29
|
+
else
|
30
|
+
render json: { errors: @business.errors.full_messages }, status: :unprocessable_entity
|
31
|
+
raise ActiveRecord::Rollback
|
32
|
+
end
|
19
33
|
else
|
34
|
+
render json: { errors: @user.errors.full_messages }, status: :unprocessable_entity
|
20
35
|
raise ActiveRecord::Rollback
|
21
|
-
render json: { errors: @business.errors.full_messages }, status: :unprocessable_entity
|
22
36
|
end
|
23
37
|
else
|
24
|
-
render json: { errors: @
|
38
|
+
render json: { errors: @address.errors.full_messages }, status: :unprocessable_entity
|
39
|
+
raise ActiveRecord::Rollback
|
25
40
|
end
|
26
41
|
end
|
27
42
|
end
|
@@ -55,7 +70,7 @@ module SnfCore
|
|
55
70
|
:first_name, :middle_name, :last_name, :password,
|
56
71
|
:phone_number, :business_name, :tin_number, :business_type,
|
57
72
|
:date_of_birth, :nationality, :occupation, :source_of_funds, :kyc_status,
|
58
|
-
:gender, :verified_at, :verified_by_id, :
|
73
|
+
:gender, :verified_at, :verified_by_id, :email
|
59
74
|
)
|
60
75
|
end
|
61
76
|
|
@@ -64,8 +79,19 @@ module SnfCore
|
|
64
79
|
:first_name, :middle_name, :last_name, :password,
|
65
80
|
:phone_number, :date_of_birth, :nationality,
|
66
81
|
:occupation, :source_of_funds, :kyc_status,
|
67
|
-
:gender, :verified_at, :verified_by_id, :
|
82
|
+
:gender, :verified_at, :verified_by_id, :email
|
68
83
|
)
|
69
84
|
end
|
85
|
+
|
86
|
+
def address_params
|
87
|
+
params.require(:address).permit(
|
88
|
+
:address_type,
|
89
|
+
:city,
|
90
|
+
:sub_city,
|
91
|
+
:woreda,
|
92
|
+
:latitude,
|
93
|
+
:longitude
|
94
|
+
)
|
95
|
+
end
|
70
96
|
end
|
71
97
|
end
|
@@ -8,7 +8,7 @@ module SnfCore
|
|
8
8
|
validates :status, presence: true
|
9
9
|
validate :valid_until_cannot_be_in_past
|
10
10
|
validate :delivery_date_cannot_be_in_past
|
11
|
-
|
11
|
+
|
12
12
|
before_validation :check_expiration
|
13
13
|
|
14
14
|
enum :status, {
|
@@ -19,7 +19,7 @@ module SnfCore
|
|
19
19
|
}
|
20
20
|
|
21
21
|
private
|
22
|
-
|
22
|
+
|
23
23
|
def check_expiration
|
24
24
|
if valid_until.present? && valid_until < DateTime.current && !expired?
|
25
25
|
self.status = :expired
|
@@ -5,8 +5,8 @@ class CreateSnfCoreAddresses < ActiveRecord::Migration[8.0]
|
|
5
5
|
t.string :city, null: false
|
6
6
|
t.string :sub_city, null: false
|
7
7
|
t.string :woreda
|
8
|
-
t.decimal :latitude
|
9
|
-
t.decimal :longitude
|
8
|
+
t.decimal :latitude
|
9
|
+
t.decimal :longitude
|
10
10
|
|
11
11
|
t.timestamps
|
12
12
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
class CreateSnfCoreQuotations < ActiveRecord::Migration[8.0]
|
2
2
|
def change
|
3
3
|
create_table :snf_core_quotations do |t|
|
4
|
-
t.references :item_request, null: false, foreign_key: {to_table: :snf_core_item_requests}
|
5
|
-
t.decimal :price
|
4
|
+
t.references :item_request, null: false, foreign_key: { to_table: :snf_core_item_requests }
|
5
|
+
t.decimal :price, null: false
|
6
6
|
t.date :delivery_date, null: false
|
7
7
|
t.datetime :valid_until, null: false
|
8
8
|
t.integer :status, null: false, default: 0
|
data/lib/snf_core/version.rb
CHANGED