dscf-core 0.1.5 → 0.1.7

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: 4a9d6f1ef3c46eb268c36d2bfa65e9a3527b91984927d6d11f3c0d1fd1199d11
4
- data.tar.gz: 6a145537fcb448e96adbf2468ac0366d2098e2faff95ca12d3a4eaeed66427ab
3
+ metadata.gz: 921baabb605b4c33c9d64f8e0839d0aebb9558e6980553f03fc35acf12286a84
4
+ data.tar.gz: 762b3316a670197ab8b24baff0140658550869a25b12424953795d0d28f972ae
5
5
  SHA512:
6
- metadata.gz: 0aca6bbe2d490e7a0e1e3673aaa177a5a63614d9ddb7128b3c6867d9d5890adbd94d0dcebcc4bdd349e88c181150b368f472d73dd9762f980188c911ac948b3e
7
- data.tar.gz: 72bc1bd02c441905cc4c88727ff0b1e3c1be321515a68938d56933f9b8c045287963f79f7c57b54277711d29c7a4514e4039eec8921c092aada1184f29e7beaf
6
+ metadata.gz: a6505e11aafa30ca100d6e371997f68407930c2f6759be12db6d63f8fc5cc6f9fb7050c206e93ba06d877bc56670ecbcb3077c5e02309a4f86bdaf600d7686cb
7
+ data.tar.gz: b2e5f301c038fed2e084d3a4aa7592a902d6c97fcbc8de51fd4a47baf8be25dbf512bd281a2584186b86fd433af89db18f3592042453d4848edc41ebff3d3c58
@@ -0,0 +1,52 @@
1
+ module Dscf
2
+ module Core
3
+ class AddressesController < ApplicationController
4
+ include Common
5
+
6
+ def index
7
+ super do
8
+ current_user.addresses
9
+ end
10
+ end
11
+
12
+ def create
13
+ super do
14
+ current_user.addresses.new(model_params)
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ # Enable authentication for this controller
21
+ def authentication_required?
22
+ true
23
+ end
24
+
25
+ def model_params
26
+ params.require(:address).permit(
27
+ :address_type, :country, :city, :sub_city,
28
+ :woreda, :kebele, :house_numbers, :po_box, :latitude, :longitude
29
+ )
30
+ end
31
+
32
+ def eager_loaded_associations
33
+ [:user]
34
+ end
35
+
36
+ # Override set_object to scope to current_user for show/update
37
+ def set_object
38
+ return unless current_user
39
+
40
+ begin
41
+ @obj = if eager_loaded_associations.present?
42
+ current_user.addresses.includes(eager_loaded_associations).find(params[:id])
43
+ else
44
+ current_user.addresses.find(params[:id])
45
+ end
46
+ rescue ActiveRecord::RecordNotFound
47
+ render_error("Address not found", status: :not_found)
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -6,6 +6,7 @@ module Dscf
6
6
  validates :first_name, presence: true
7
7
  validates :last_name, presence: true
8
8
  validates :watchlist_hit, inclusion: {in: [true, false]}
9
+ attribute :verification_status, :integer, default: 0
9
10
  validates :verification_status, presence: true
10
11
 
11
12
  enum :gender, {
data/config/routes.rb CHANGED
@@ -4,4 +4,6 @@ Dscf::Core::Engine.routes.draw do
4
4
  post "auth/signup", to: "auth#signup"
5
5
  post "auth/refresh", to: "auth#refresh"
6
6
  get "auth/me", to: "auth#me"
7
+
8
+ resources :addresses, only: %i[index show create update]
7
9
  end
@@ -1,5 +1,5 @@
1
1
  module Dscf
2
2
  module Core
3
- VERSION = "0.1.5".freeze
3
+ VERSION = "0.1.7".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dscf-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Asrat
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-08-31 00:00:00.000000000 Z
10
+ date: 2025-09-16 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails
@@ -431,6 +431,7 @@ files:
431
431
  - app/controllers/concerns/dscf/core/json_response.rb
432
432
  - app/controllers/concerns/dscf/core/pagination.rb
433
433
  - app/controllers/concerns/dscf/core/token_authenticatable.rb
434
+ - app/controllers/dscf/core/addresses_controller.rb
434
435
  - app/controllers/dscf/core/application_controller.rb
435
436
  - app/controllers/dscf/core/auth_controller.rb
436
437
  - app/errors/dscf/core/authentication_error.rb