新增:路由匹配特殊符号

This commit is contained in:
yystopf 2023-02-06 09:49:36 +08:00
parent 0800f9e6e0
commit 7c911f5b86
4 changed files with 10 additions and 6 deletions

View File

@ -16,7 +16,7 @@ class Api::V1::Projects::BranchesController < Api::V1::BaseController
end end
def destroy def destroy
@result_object = Api::V1::Projects::Branches::DeleteService.call(@project, params[:id], current_user&.gitea_token) @result_object = Api::V1::Projects::Branches::DeleteService.call(@project, params[:name], current_user&.gitea_token)
if @result_object if @result_object
return render_ok return render_ok
else else
@ -27,7 +27,7 @@ class Api::V1::Projects::BranchesController < Api::V1::BaseController
before_action :require_manager_above, only: [:update_default_branch] before_action :require_manager_above, only: [:update_default_branch]
def update_default_branch def update_default_branch
@result_object = Api::V1::Projects::Branches::UpdateDefaultBranchService.call(@project, params[:default_branch], current_user&.gitea_token) @result_object = Api::V1::Projects::Branches::UpdateDefaultBranchService.call(@project, params[:name], current_user&.gitea_token)
if @result_object if @result_object
return render_ok return render_ok
else else

View File

@ -8,7 +8,7 @@ class Api::V1::Projects::TagsController < Api::V1::BaseController
before_action :require_operate_above, only: [:destroy] before_action :require_operate_above, only: [:destroy]
def destroy def destroy
@result_object = Api::V1::Projects::Tags::DeleteService.call(@project, params[:id], current_user&.gitea_token) @result_object = Api::V1::Projects::Tags::DeleteService.call(@project, params[:name], current_user&.gitea_token)
if @result_object if @result_object
return render_ok return render_ok
else else

View File

@ -17,7 +17,7 @@ class Api::V1::Projects::Tags::DeleteService < ApplicationService
def call def call
raise Error, errors.full_messages.join(",") unless valid? raise Error, errors.full_messages.join(",") unless valid?
check_tag_exist # check_tag_exist
excute_data_to_gitea excute_data_to_gitea
true true

View File

@ -46,13 +46,17 @@ defaults format: :json do
get :hooktasks get :hooktasks
end end
end end
resources :branches, only:[:index, :create, :destroy] do resources :branches, param: :name, only:[:index, :create, :destroy] do
collection do collection do
get :all get :all
patch :update_default_branch patch :update_default_branch
end end
end end
resources :tags, only: [:index, :destroy] match 'branches/*name', to: "branches#destroy", via: :all
resources :tags, param: :name, only: [:index, :destroy]
match 'tags/*name', to: "tags#destroy", via: :all
resources :commits, only: [:index] resources :commits, only: [:index]
resources :code_stats, only: [:index] resources :code_stats, only: [:index]
get '/commits/:sha/diff', to: 'commits#diff' get '/commits/:sha/diff', to: 'commits#diff'