You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
637 B
13 lines
637 B
1 year ago
|
namespace :merge do
|
||
|
desc "Merge organisations into one"
|
||
|
task :merge_organisations, %i[absorbing_organisation_id merging_organisation_ids] => :environment do |_task, args|
|
||
|
absorbing_organisation_id = args[:absorbing_organisation_id]
|
||
|
merging_organisation_ids = args[:merging_organisation_ids]&.split(" ")&.map(&:to_i)
|
||
|
|
||
|
raise "Usage: rake merge:merge_organisations[absorbing_organisation_id, merging_organisation_ids]" if merging_organisation_ids.blank? || absorbing_organisation_id.blank?
|
||
|
|
||
|
service = Merge::MergeOrganisationsService.new(absorbing_organisation_id:, merging_organisation_ids:)
|
||
|
service.call
|
||
|
end
|
||
|
end
|