From 7265af094ed16c36632128bccdcf84a3796c2359 Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Sat, 25 Mar 2023 00:10:33 -0600 Subject: AƱade specs de addresscontroller MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/addresses_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app/controllers/api') 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 -- cgit v1.2.3