mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-31 02:57:57 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			35 lines
		
	
	
		
			628 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			628 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| class Api::V1::Accounts::TeamsController < Api::V1::Accounts::BaseController
 | |
|   before_action :fetch_team, only: [:show, :update, :destroy]
 | |
|   before_action :check_authorization
 | |
| 
 | |
|   def index
 | |
|     @teams = Current.account.teams
 | |
|   end
 | |
| 
 | |
|   def show; end
 | |
| 
 | |
|   def create
 | |
|     @team = Current.account.teams.new(team_params)
 | |
|     @team.save!
 | |
|   end
 | |
| 
 | |
|   def update
 | |
|     @team.update!(team_params)
 | |
|   end
 | |
| 
 | |
|   def destroy
 | |
|     @team.destroy!
 | |
|     head :ok
 | |
|   end
 | |
| 
 | |
|   private
 | |
| 
 | |
|   def fetch_team
 | |
|     @team = Current.account.teams.find(params[:id])
 | |
|   end
 | |
| 
 | |
|   def team_params
 | |
|     params.require(:team).permit(:name, :description, :allow_auto_assign)
 | |
|   end
 | |
| end
 | 
