added logs

This commit is contained in:
oleghasjanov 2024-09-27 10:20:16 +03:00
parent 6b1a62cf2c
commit b3ac165bd3
4 changed files with 13 additions and 2 deletions

View file

@ -11,6 +11,8 @@ module Domains
# Allow deletion
statuses.delete(DomainStatus::CLIENT_DELETE_PROHIBITED)
puts "Try to save domain: #{domain.name} with statuses: #{statuses}"
domain.save(validate: false)
end
end

View file

@ -9,6 +9,7 @@ module Domains
compose(NotifyRegistrar, inputs.to_h)
compose(NotifyByEmail, inputs.to_h)
compose(NotifyMultiyearsExpirationDomain, inputs.to_h)
puts "SetForceDelete has been executed"
end
end
end

View file

@ -48,6 +48,7 @@ module Domain::ForceDelete
end
def schedule_force_delete(type: :fast_track, notify_by_email: false, reason: nil, email: nil)
puts "Schedule force delete for domain: #{name} with type: #{type}"
Domains::ForceDelete::SetForceDelete.run(domain: self, type: type, reason: reason,
notify_by_email: notify_by_email, email: email)
end

View file

@ -27,6 +27,8 @@ namespace :company_status do
are_registrants_only = options[:registrants_only]
sleep_time = options[:sleep_time]
puts "SOFT DELETE ENABLE: #{soft_delete_enable}"
puts "*** Run 1 step. Downloading fresh open data file. ***"
remove_old_file(DESTINATION + downloaded_filename)
download_open_data_file(download_path, downloaded_filename)
@ -166,7 +168,7 @@ namespace :company_status do
if resp.empty?
put_company_to_missing_file(contact: contact, path: missing_companies_in_business_registry_path)
puts "Company: #{contact.name} with ident: #{contact.ident} and ID: #{contact.id} is missing in registry, company id: #{contact.id}"
soft_delete_company(contact)
soft_delete_company(contact) if soft_delete_enable
else
status = resp.first.status.upcase
kandeliik_type = resp.first.kandeliik.last.last.kandeliik
@ -180,7 +182,7 @@ namespace :company_status do
write_to_csv_file(csv_file_path: csv_file_path, headers: headers, attrs: attrs)
puts "Company: #{contact.name} with ident: #{contact.ident} and ID: #{contact.id} has status #{status}, company id: #{contact.id}"
soft_delete_company(contact)
soft_delete_company(contact) if soft_delete_enable
end
end
end
@ -198,10 +200,15 @@ namespace :company_status do
# domain.schedule_force_delete(type: :soft)
# end
#
puts "Try to set soft delete for company: #{contact.name} with ID: #{contact.id}"
puts "Contact domains: #{contact.domains.map(&:name)}"
contact.domains.each do |domain|
puts "Domain: #{domain.name} with force delete scheduled: #{domain.force_delete_scheduled?}"
next if domain.force_delete_scheduled?
puts "Try to set soft delete for domain: #{domain.name}"
domain.schedule_force_delete(type: :soft)
puts "Soft delete process initiated for company: #{contact.name} with ID: #{contact.id} domain: #{domain.name}"
end