forked from Trustie/forgeplus
fix sca
This commit is contained in:
parent
6a426b164d
commit
6dc84f1dd6
|
|
@ -1,10 +1,18 @@
|
|||
class Api::V1::Projects::ScaController < Api::V1::BaseController
|
||||
before_action :require_public_and_member_above
|
||||
before_action :load_project
|
||||
def index
|
||||
def index
|
||||
@result = Api::V1::Projects::Sca::ShowProjectService.call(@project)
|
||||
end
|
||||
def create
|
||||
@result = Api::V1::Projects::Sca::CreateProjectService.call(@project)
|
||||
result = Api::V1::Projects::Sca::CreateProjectService.call(@project)
|
||||
if result
|
||||
@result = Api::V1::Projects::Sca::ShowProjectService.call(@project)
|
||||
else
|
||||
{
|
||||
auth_token: nil,
|
||||
"url": nil,
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,7 +1,11 @@
|
|||
class Api::V1::Projects::Sca::BaseService < ApplicationService
|
||||
private
|
||||
def base_url
|
||||
Rails.application.config_for(:configuration)["sca"]["domain"] + Rails.application.config_for(:configuration)["sca"]["base_url"]
|
||||
domain_url + Rails.application.config_for(:configuration)["sca"]["base_url"]
|
||||
end
|
||||
|
||||
def domain_url
|
||||
Rails.application.config_for(:configuration)["sca"]["domain"]
|
||||
end
|
||||
|
||||
def auth_token
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@ class Api::V1::Projects::Sca::CreateProjectService < Api::V1::Projects::Sca::Ba
|
|||
}
|
||||
data = sca_post_request("projects/", params)
|
||||
if @project.update(sca_project_id:data[:json]["id"])
|
||||
Api::V1::Projects::Sca::ShowProjectService.call(@project)
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class Api::V1::Projects::Sca::ShowProjectService < Api::V1::Projects::Sca::Base
|
|||
#projects/18748/list-branches/?branch_name_query=&page=1&limit=5
|
||||
{
|
||||
auth_token:login_token,
|
||||
"url": base_url + "org/#{sca_user_info["default_org"]}/projects/#{@project.sca_project_id}?engine=sca" ,
|
||||
"url": domain_url + "/org/#{sca_user_info["default_org"]}/projects/#{@project.sca_project_id}?engine=sca" ,
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue