为项目新增sonar_url 且增加回调接口
This commit is contained in:
parent
38e55cea40
commit
91fa87ada5
1
Gemfile
1
Gemfile
|
@ -63,6 +63,7 @@ end
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
gem 'prettier'
|
gem 'prettier'
|
||||||
|
gem 'pry-rails', '~> 0.3.9'
|
||||||
gem 'rubocop', '~> 0.52.0'
|
gem 'rubocop', '~> 0.52.0'
|
||||||
gem 'solargraph', '~> 0.38.0'
|
gem 'solargraph', '~> 0.38.0'
|
||||||
gem 'awesome_print'
|
gem 'awesome_print'
|
||||||
|
|
|
@ -99,6 +99,7 @@ GEM
|
||||||
archive-zip (~> 0.10)
|
archive-zip (~> 0.10)
|
||||||
nokogiri (~> 1.8)
|
nokogiri (~> 1.8)
|
||||||
chunky_png (1.3.11)
|
chunky_png (1.3.11)
|
||||||
|
coderay (1.1.3)
|
||||||
concurrent-ruby (1.1.6)
|
concurrent-ruby (1.1.6)
|
||||||
connection_pool (2.2.2)
|
connection_pool (2.2.2)
|
||||||
crass (1.0.6)
|
crass (1.0.6)
|
||||||
|
@ -217,6 +218,11 @@ GEM
|
||||||
popper_js (1.16.0)
|
popper_js (1.16.0)
|
||||||
powerpack (0.1.2)
|
powerpack (0.1.2)
|
||||||
prettier (0.18.2)
|
prettier (0.18.2)
|
||||||
|
pry (0.12.2)
|
||||||
|
coderay (~> 1.1.0)
|
||||||
|
method_source (~> 0.9.0)
|
||||||
|
pry-rails (0.3.9)
|
||||||
|
pry (>= 0.10.4)
|
||||||
public_suffix (4.0.3)
|
public_suffix (4.0.3)
|
||||||
puma (3.12.2)
|
puma (3.12.2)
|
||||||
raabro (1.4.0)
|
raabro (1.4.0)
|
||||||
|
@ -469,6 +475,7 @@ DEPENDENCIES
|
||||||
parallel (~> 1.19, >= 1.19.1)
|
parallel (~> 1.19, >= 1.19.1)
|
||||||
pdfkit
|
pdfkit
|
||||||
prettier
|
prettier
|
||||||
|
pry-rails (~> 0.3.9)
|
||||||
puma (~> 3.11)
|
puma (~> 3.11)
|
||||||
rack-cors
|
rack-cors
|
||||||
rack-mini-profiler
|
rack-mini-profiler
|
||||||
|
|
|
@ -4,7 +4,7 @@ class ProjectsController < ApplicationController
|
||||||
include ProjectsHelper
|
include ProjectsHelper
|
||||||
include Acceleratorable
|
include Acceleratorable
|
||||||
|
|
||||||
before_action :require_login, except: %i[index branches branches_slice group_type_list simple show fork_users praise_users watch_users recommend about menu_list]
|
before_action :require_login, except: %i[index branches branches_slice group_type_list simple show fork_users praise_users watch_users recommend about menu_list sonar_url]
|
||||||
before_action :require_profile_completed, only: [:create, :migrate]
|
before_action :require_profile_completed, only: [:create, :migrate]
|
||||||
before_action :load_repository, except: %i[index group_type_list migrate create recommend]
|
before_action :load_repository, except: %i[index group_type_list migrate create recommend]
|
||||||
before_action :authorizate_user_can_edit_project!, only: %i[update]
|
before_action :authorizate_user_can_edit_project!, only: %i[update]
|
||||||
|
@ -225,6 +225,14 @@ class ProjectsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def sonar_url
|
||||||
|
token = request.headers["HTTP_SONAR_TOKEN"]
|
||||||
|
playod = JWT.decode(token,EducoderOauth.client_id)[0]
|
||||||
|
data = HashWithIndifferentAccess.new playod
|
||||||
|
return normal_status(-1, "sonar_url不能为空") if data["sonar_url"].blank?
|
||||||
|
@project.update(sonar_url:data["sonar_url"])
|
||||||
|
render :json => { status: 0, message: "更新成功"}
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def project_params
|
def project_params
|
||||||
|
|
|
@ -54,6 +54,7 @@ module ProjectsHelper
|
||||||
tmp_json = tmp_json.merge({
|
tmp_json = tmp_json.merge({
|
||||||
identifier: render_identifier(project),
|
identifier: render_identifier(project),
|
||||||
name: project.name,
|
name: project.name,
|
||||||
|
sonar_url: project.sonar_url,
|
||||||
platform: project.platform,
|
platform: project.platform,
|
||||||
id: project.id,
|
id: project.id,
|
||||||
repo_id: repo.id,
|
repo_id: repo.id,
|
||||||
|
|
|
@ -422,6 +422,7 @@ Rails.application.routes.draw do
|
||||||
get :branches
|
get :branches
|
||||||
get :branches_slice
|
get :branches_slice
|
||||||
get :simple
|
get :simple
|
||||||
|
post :sonar_url
|
||||||
get :watchers, to: 'projects#watch_users'
|
get :watchers, to: 'projects#watch_users'
|
||||||
get :stargazers, to: 'projects#praise_users'
|
get :stargazers, to: 'projects#praise_users'
|
||||||
get :members, to: 'projects#fork_users'
|
get :members, to: 'projects#fork_users'
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddSonarUrlToProjects < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
add_column :projects, :sonar_url, :string
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue