mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-13 08:15:55 +08:00
新增:项目搜索标签删除逻辑
This commit is contained in:
@@ -24,6 +24,21 @@ class Api::V1::ProjectTopicsController < Api::V1::BaseController
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
ActiveRecord::Base.transaction do
|
||||
@project = Project.find_by_id(create_params[:project_id])
|
||||
return render_not_found unless @project.present?
|
||||
|
||||
@project_topic = ProjectTopic.find_by_id(params[:id])
|
||||
@project_topic_ralate = @project_topic.project_topic_ralates.find_by(project_id: @project.id)
|
||||
if @project_topic_ralate.destroy!
|
||||
render_ok
|
||||
else
|
||||
render_error("项目取消关联搜索标签失败.")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def create_params
|
||||
params.permit(:project_id, :name)
|
||||
|
||||
Reference in New Issue
Block a user