mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 14:44:47 +02:00
Merge remote-tracking branch 'origin/master' into 1580-registrar-api-contacts-endpoint
This commit is contained in:
commit
db50a89d85
51 changed files with 801 additions and 285 deletions
|
@ -5,10 +5,13 @@ module Repp
|
|||
before_action :verify_nameserver_existance, only: %i[update]
|
||||
|
||||
def update
|
||||
domains = current_user.registrar
|
||||
.replace_nameservers(hostname, hostname_params[:data][:attributes])
|
||||
domains = params[:data][:domains] || []
|
||||
affected = current_user.registrar
|
||||
.replace_nameservers(hostname,
|
||||
hostname_params[:data][:attributes],
|
||||
domains: domains)
|
||||
|
||||
render_success(data: data_format_for_success(domains))
|
||||
render_success(data: data_format_for_success(affected))
|
||||
rescue ActiveRecord::RecordInvalid => e
|
||||
handle_errors(e.record)
|
||||
end
|
||||
|
@ -16,15 +19,23 @@ module Repp
|
|||
private
|
||||
|
||||
def data_format_for_success(affected_domains)
|
||||
{ type: 'nameserver', id: params[:data][:attributes][:hostname],
|
||||
attributes: params[:data][:attributes], affected_domains: affected_domains }
|
||||
{
|
||||
type: 'nameserver',
|
||||
id: params[:data][:attributes][:hostname],
|
||||
attributes: params[:data][:attributes],
|
||||
affected_domains: affected_domains,
|
||||
}
|
||||
end
|
||||
|
||||
def hostname_params
|
||||
params.require(:data).require(%i[type id])
|
||||
params.require(:data).require(:attributes).require([:hostname])
|
||||
|
||||
params.permit(data: [:type, :id, attributes: [:hostname, ipv4: [], ipv6: []]])
|
||||
params.permit(data: [
|
||||
:type, :id,
|
||||
{ domains: [],
|
||||
attributes: [:hostname, { ipv4: [], ipv6: [] }] },
|
||||
])
|
||||
end
|
||||
|
||||
def hostname
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue