Add ImportCreationJob
This commit is contained in:
		
							parent
							
								
									dd30aa3d59
								
							
						
					
					
						commit
						9c9033f2d3
					
				
					 2 changed files with 14 additions and 7 deletions
				
			
		|  | @ -9,13 +9,7 @@ module Nonprofits | ||||||
|     # post /nonprofits/:nonprofit_id/imports |     # post /nonprofits/:nonprofit_id/imports | ||||||
|     def create |     def create | ||||||
|       render_json do |       render_json do | ||||||
|         InsertImport.delay.from_csv_safe( |         ImportCreationJob.perform_later(import_params, current_user) | ||||||
|           nonprofit_id: import_params[:nonprofit_id], |  | ||||||
|           user_id: current_user.id, |  | ||||||
|           user_email: current_user.email, |  | ||||||
|           file_uri: import_params[:file_uri], |  | ||||||
|           header_matches: import_params[:header_matches] |  | ||||||
|         ) |  | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										13
									
								
								app/jobs/import_creation_job.rb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								app/jobs/import_creation_job.rb
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,13 @@ | ||||||
|  | class ImportCreationJob < ApplicationJob | ||||||
|  |   queue_as :default | ||||||
|  | 
 | ||||||
|  |   def perform(import_params, current_user) | ||||||
|  |     InsertImport.from_csv_safe( | ||||||
|  |       nonprofit_id: import_params[:nonprofit_id], | ||||||
|  |       user_id: current_user.id, | ||||||
|  |       user_email: current_user.email, | ||||||
|  |       file_uri: import_params[:file_uri], | ||||||
|  |       header_matches: import_params[:header_matches] | ||||||
|  |     ) | ||||||
|  |   end | ||||||
|  | end | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Eric Schultz
						Eric Schultz