mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-31 02:57:57 +00:00 
			
		
		
		
	 16fe912fbd
			
		
	
	16fe912fbd
	
	
	
		
			
			Co-authored-by: Nithin David Thomas <webofnithin@gmail.com> Co-authored-by: Sojan Jose <sojan@pepalo.com>
		
			
				
	
	
		
			27 lines
		
	
	
		
			608 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			608 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| class Api::V1::Widget::InboxesController < ApplicationController
 | |
|   def create
 | |
|     ActiveRecord::Base.transaction do
 | |
|       channel = web_widgets.create!(
 | |
|         website_name: permitted_params[:website_name],
 | |
|         website_url: permitted_params[:website_url]
 | |
|       )
 | |
|       inbox = inboxes.create!(name: permitted_params[:website_name], channel: channel)
 | |
|       render json: inbox
 | |
|     end
 | |
|   end
 | |
| 
 | |
|   private
 | |
| 
 | |
|   def inboxes
 | |
|     current_account.inboxes
 | |
|   end
 | |
| 
 | |
|   def web_widgets
 | |
|     current_account.web_widgets
 | |
|   end
 | |
| 
 | |
|   def permitted_params
 | |
|     params.fetch(:website).permit(:website_name, :website_url)
 | |
|   end
 | |
| end
 |