added callback to transform string period to int

This commit is contained in:
olegphenomenon 2022-11-10 13:14:16 +02:00
parent c96a9bd6e1
commit d3bc769d5b

View file

@ -7,6 +7,7 @@ module Repp
before_action :validate_registrar_authorization, only: %i[transfer_info destroy]
before_action :forward_registrar_id, only: %i[create update destroy]
before_action :set_domain, only: %i[update]
before_action :transaform_period_value_to_integer, only: %i[create]
THROTTLED_ACTIONS = %i[transfer_info transfer index create show update destroy].freeze
include Shunter::Integration::Throttle
@ -257,6 +258,10 @@ module Repp
modify_contact_params(dup_params)
end
def transaform_period_value_to_integer
params[:domain][:period] = params[:domain][:period].to_i
end
def modify_contact_params(params)
new_contact_params = params[:contacts].map { |c| c.to_h.symbolize_keys }
old_contact_params = @domain.domain_contacts.includes(:contact).map do |c|