|
|
|
|
@ -7,13 +7,17 @@ namespace :core do
|
|
|
|
|
|
|
|
|
|
# We only allow a reduced list of known fields to be updatable |
|
|
|
|
case field |
|
|
|
|
when "tenancycode", "major_repairs", "lettings_allocation", "offered" |
|
|
|
|
when "tenancycode", "major_repairs", "lettings_allocation", "offered", "owning_organisation_id" |
|
|
|
|
s3_service = Storage::S3Service.new(PlatformHelper.is_paas? ? Configuration::PaasConfigurationService.new : Configuration::EnvConfigurationService.new, ENV["IMPORT_PAAS_INSTANCE"]) |
|
|
|
|
archive_io = s3_service.get_file_io(path) |
|
|
|
|
archive_service = Storage::ArchiveService.new(archive_io) |
|
|
|
|
if archive_service.folder_present?("logs") |
|
|
|
|
Rails.logger.info("Start importing field from folder logs") |
|
|
|
|
if field == "owning_organisation_id" |
|
|
|
|
Imports::SalesLogsFieldImportService.new(archive_service).update_field(field, "logs") |
|
|
|
|
else |
|
|
|
|
Imports::LettingsLogsFieldImportService.new(archive_service).update_field(field, "logs") |
|
|
|
|
end |
|
|
|
|
Rails.logger.info("Imported") |
|
|
|
|
end |
|
|
|
|
else |
|
|
|
|
|