From 753bf8499ba5d8815db8d08a1dcf69caa20660cf Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Sat, 1 Apr 2023 12:00:33 -0600 Subject: Mejora estructura del proyecto --- .../services/addresses/update_address_service.rb | 30 ---------------------- 1 file changed, 30 deletions(-) delete mode 100644 app/controllers/services/addresses/update_address_service.rb (limited to 'app/controllers/services/addresses/update_address_service.rb') diff --git a/app/controllers/services/addresses/update_address_service.rb b/app/controllers/services/addresses/update_address_service.rb deleted file mode 100644 index b9ffbde..0000000 --- a/app/controllers/services/addresses/update_address_service.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -module Services - module Addresses - # The service for address creation. - class UpdateAddressService < AddressServicesBase - attr_reader :address - - def initialize(user_account, address_id, params) - super(user_account, params) - @address_id = address_id - end - - def call - @address = @user_account.addresses.find_by(id: @address_id) - - return :not_found if @address.nil? - - if already_existing_address.nil? - return :unprocessable_entity unless @address.update(@params) - else - add_address_to_user_addresses - @address.user_account_addresses.find_by(user_account_id: @user_account.id).destroy - @address.destroy if @address.user_accounts.count.zero? - @address = already_existing_address - end - end - end - end -end -- cgit v1.2.3