mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 12:08:27 +02:00
WIP with contact import
This commit is contained in:
parent
3149d0731d
commit
a598b46723
4 changed files with 63 additions and 3 deletions
|
@ -1,9 +1,9 @@
|
|||
namespace :import do
|
||||
desc "Imports registrars"
|
||||
desc 'Imports registrars'
|
||||
task registrars: :environment do
|
||||
puts '-----> Importing registrars...'
|
||||
|
||||
# Registrar.where('legacy_id IS NOT NULL').delete_all
|
||||
Registrar.where('legacy_id IS NOT NULL').delete_all
|
||||
|
||||
registrars = []
|
||||
existing_ids = Registrar.pluck(:legacy_id)
|
||||
|
@ -27,7 +27,9 @@ namespace :import do
|
|||
url: x.url.try(:strip),
|
||||
directo_handle: x.directo_handle.try(:strip),
|
||||
vat: x.vat,
|
||||
legacy_id: x.id
|
||||
legacy_id: x.id,
|
||||
creator_str: "rake-#{`whoami`.strip} #{ARGV.join ' '}",
|
||||
updator_str: "rake-#{`whoami`.strip} #{ARGV.join ' '}"
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -35,4 +37,46 @@ namespace :import do
|
|||
|
||||
puts '-----> Registrars imported'
|
||||
end
|
||||
|
||||
# desc 'Import contacts'
|
||||
# task contact: :environment do
|
||||
# puts '-----> Importing contacts...'
|
||||
|
||||
# contacts = []
|
||||
# existing_ids = Contact.pluck(:legacy_id)
|
||||
|
||||
# Legacy::Contact.all.each do |x|
|
||||
# next if existing_ids.include?(x.id)
|
||||
|
||||
# 1;"RC";"born number"
|
||||
# 2;"OP";"identity card number" -> priv
|
||||
# 3;"PASS";"passwport" ->
|
||||
# 4;"ICO";"organization identification number"
|
||||
# 5;"MPSV";"social system identification"
|
||||
# 6;"BIRTHDAY";"day of birth"
|
||||
|
||||
# contacts << Contact.new({
|
||||
# code: ,
|
||||
# #type: , # not needed
|
||||
# #reg_no: x.ssn.try(:strip),
|
||||
# phone: x.telephone.try(:strip),
|
||||
# email: x.email.try(:strip),
|
||||
# fax: x.fax.try(:strip),
|
||||
# ident: x.ssn.try(:strip),
|
||||
# ident_type: ,
|
||||
# #created_by_id: , # not needed
|
||||
# #updated_by_id: , # not needed
|
||||
# auth_info: ,
|
||||
# name: x.name.try(:strip),
|
||||
# org_name: x.organization.try(:strip),
|
||||
# registrar_id: ,
|
||||
# creator_str: "rake-#{`whoami`.strip} #{ARGV.join ' '}",
|
||||
# updator_str: "rake-#{`whoami`.strip} #{ARGV.join ' '}"
|
||||
# ident_country_code: x.country.try(:strip),
|
||||
# legacy_id: x.id
|
||||
# })
|
||||
# end
|
||||
|
||||
# puts '-----> Contacts imported'
|
||||
# end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue