2021-01-17 18:26:56 +00:00
|
|
|
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
|
2022-03-24 07:58:25 +00:00
|
|
|
@team.destroy!
|
2021-01-17 18:26:56 +00:00
|
|
|
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
|