class Api::V1::Projects::BranchesController < Api::V1::BaseController 
  before_action :require_public_and_member_above, only: [:all] 

  def all 
    @result_object = Api::V1::Projects::Branches::AllListService.call(@project, current_user&.gitea_token)
  end

  before_action :require_operate_above, only: [:create] 

  def create 
    @result_object = Api::V1::Projects::Branches::CreateService.call(@project, branch_params, current_user&.gitea_token)
  end

  private 
  def branch_params 
    params.require(:branch).permit(:new_branch_name, :old_branch_name)
  end
end