新增:删除分支接口

This commit is contained in:
2023-02-03 15:03:59 +08:00
parent f2cdba29ea
commit 8b90164247
3 changed files with 53 additions and 2 deletions

View File

@@ -9,12 +9,21 @@ class Api::V1::Projects::BranchesController < Api::V1::BaseController
@result_object = Api::V1::Projects::Branches::AllListService.call(@project, current_user&.gitea_token)
end
before_action :require_operate_above, only: [:create]
before_action :require_operate_above, only: [:create, :destroy]
def create
@result_object = Api::V1::Projects::Branches::CreateService.call(@project, branch_params, current_user&.gitea_token)
end
def destroy
@result_object = Api::V1::Projects::Branches::DeleteService.call(@project, params[:id], current_user&.gitea_token)
if @result_object
return render_ok
else
return render_error('删除分支失败!')
end
end
before_action :require_manager_above, only: [:update_default_branch]
def update_default_branch