Class: CdmMigrator::BatchCreateWorksJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
app/jobs/cdm_migrator/batch_create_works_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(ingest, user) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/jobs/cdm_migrator/batch_create_works_job.rb', line 5

def perform(ingest, user)
  ingest.data.each do |w|
    ingest_work = IngestWork.new({
       work_type: w[:type],
       data: w[:metadata],
       files: w[:files],
       batch_ingest_id: ingest.id
    })
    ingest_work.save!
    # puts ingest_work.inspect
    CreateWorkJob.perform_later ingest_work, user, ingest.admin_set_id, ingest.collection_id
  end

end