REPP: Add contact:destroy action

This commit is contained in:
Karl Erik Õunapuu 2020-10-21 11:54:25 +03:00
parent 516b2180ca
commit f9bef781ab
No known key found for this signature in database
GPG key ID: C9DD647298A34764
5 changed files with 104 additions and 30 deletions

View file

@ -1,7 +1,7 @@
module Repp
module V1
class ContactsController < BaseController
before_action :find_contact, only: %i[show update]
before_action :find_contact, only: %i[show update destroy]
## GET /repp/v1/contacts
def index
@ -53,6 +53,16 @@ module Repp
render_success(create_update_success_body)
end
def destroy
action = Actions::ContactDelete.new(@contact, params[:legal_document])
unless action.call
handle_errors(@contact)
return
end
render_success
end
def contact_addr_present?
return false unless contact_addr_params.key?(:addr)