Add affected domain parameter to REST API response

This commit is contained in:
Maciej Szlosarczyk 2018-07-05 17:24:32 +03:00
parent b5f07682f4
commit 3e81366cfc
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765
6 changed files with 12 additions and 7 deletions

View file

@ -29,7 +29,7 @@ module Repp
}
begin
current_user.registrar.replace_nameservers(hostname, new_attributes)
affected_domains = current_user.registrar.replace_nameservers(hostname, new_attributes)
rescue ActiveRecord::RecordInvalid => e
error!({ errors: e.record.errors.full_messages.map { |error| { title: error } } }, 400)
end
@ -37,7 +37,8 @@ module Repp
status 200
@response = { data: { type: 'nameserver',
id: params[:data][:attributes][:hostname],
attributes: params[:data][:attributes] } }
attributes: params[:data][:attributes],
affected_domains: affected_domains } }
end
end
end