a0c33254e7
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
34 lines
627 B
Ruby
34 lines
627 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
|