summaryrefslogtreecommitdiff
path: root/app/controllers/api
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/api')
-rw-r--r--app/controllers/api/addresses_controller.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/controllers/api/addresses_controller.rb b/app/controllers/api/addresses_controller.rb
index e233fcc..3319607 100644
--- a/app/controllers/api/addresses_controller.rb
+++ b/app/controllers/api/addresses_controller.rb
@@ -10,7 +10,7 @@ module Api
end
def create
- @service = Services::CreateAddressService.new(current_user_account, service_params)
+ @service = Services::Addresses::CreateAddressService.new(current_user_account, service_params)
begin
unless @service.call
@@ -27,7 +27,7 @@ module Api
end
def update
- @service = Services::UpdateAddressService.new(current_user_account, params[:id], service_params)
+ @service = Services::Addresses::UpdateAddressService.new(current_user_account, params[:id], service_params)
begin
case @service.call
@@ -45,11 +45,11 @@ module Api
end
def destroy
- @address = Address.find_by(id: params[:id])
+ @address = current_user_account.addresses.find_by(id: params[:id])
render json: { error_message: 'Not found' }, status: :not_found and return if @address.nil?
- @address.destroy
+ Services::Addresses::DestroyAddressService.new(current_user_account, params, @address).call
render status: :see_other
end