From d3bc769d5b942f5e0f7f6a4196d7378631428744 Mon Sep 17 00:00:00 2001 From: olegphenomenon Date: Thu, 10 Nov 2022 13:14:16 +0200 Subject: [PATCH] added callback to transform string period to int --- app/controllers/repp/v1/domains_controller.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/controllers/repp/v1/domains_controller.rb b/app/controllers/repp/v1/domains_controller.rb index c72c83882..383cb8e76 100644 --- a/app/controllers/repp/v1/domains_controller.rb +++ b/app/controllers/repp/v1/domains_controller.rb @@ -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|