Browse Source

Add some additional fields to export

pull/2652/head
Kat 2 years ago
parent
commit
9cbc5f5099
  1. 5
      app/services/exports/organisation_export_constants.rb
  2. 8
      app/services/exports/organisation_export_service.rb
  3. 5
      spec/fixtures/exports/organisation.xml
  4. 2
      spec/services/exports/organisation_export_service_spec.rb

5
app/services/exports/organisation_export_constants.rb

@ -17,6 +17,9 @@ module Exports::OrganisationExportConstants
"merge_date",
"absorbing_organisation_id",
"available_from",
"discarded_at",
"deleted_at",
"dsa_signed",
"dsa_signed_at",
"dpo_email"
]
end

8
app/services/exports/organisation_export_service.rb

@ -57,7 +57,13 @@ module Exports
end
def apply_cds_transformation(organisation)
organisation.attributes
attribute_hash = organisation.attributes
attribute_hash["deleted_at"] = organisation.discarded_at
attribute_hash["dsa_signed"] = organisation.data_protection_confirmed?
attribute_hash["dsa_signed_at"] = organisation.data_protection_confirmation&.signed_at
attribute_hash["dpo_email"] = organisation.data_protection_confirmation&.data_protection_officer_email
attribute_hash
end
end
end

5
spec/fixtures/exports/organisation.xml vendored

@ -16,6 +16,9 @@
<merge_date/>
<absorbing_organisation_id/>
<available_from/>
<discarded_at/>
<deleted_at/>
<dsa_signed>true</dsa_signed>
<dsa_signed_at>{dsa_signed_at}</dsa_signed_at>
<dpo_email>{dpo_email}</dpo_email>
</form>
</forms>

2
spec/services/exports/organisation_export_service_spec.rb

@ -16,6 +16,8 @@ RSpec.describe Exports::OrganisationExportService do
def replace_entity_ids(organisation, export_template)
export_template.sub!(/\{id\}/, organisation["id"].to_s)
export_template.sub!(/\{dsa_signed_at\}/, organisation.data_protection_confirmation&.signed_at.to_s)
export_template.sub!(/\{dpo_email\}/, organisation.data_protection_confirmation&.data_protection_officer_email)
end
def replace_record_number(export_template, record_number)

Loading…
Cancel
Save