新增:仓库列表和分支列表

This commit is contained in:
2024-04-17 10:54:23 +08:00
parent 7271603248
commit 8b1ef7bf15
7 changed files with 39 additions and 5 deletions

View File

@@ -1,6 +1,11 @@
class Api::V1::Projects::SyncRepositoriesController < Api::V1::BaseController
before_action :require_public_and_member_above
def index
@sync_repositories = @project.sync_repositories
@group_sync_repository = @project.sync_repositories.group(:type, :external_repo_address, :sync_granularity).count
end
def create
@sync_repository1, @sync_repository2, @sync_repository_branch1, @sync_repository_branch2 = Api::V1::Projects::SyncRepositories::CreateService.call(@project, sync_repository_params)
end
@@ -16,6 +21,12 @@ class Api::V1::Projects::SyncRepositoriesController < Api::V1::BaseController
end
end
def branches
return render_error("请输入正确的同步项目ID") unless params[:sync_repository_ids].present?
@sync_repository_branches = SyncRepositoryBranch.where(sync_repository_id: params[:sync_repository_ids].split(","))
@group_sync_repository_branch = @sync_repository_branches.group(:gitlink_branch_name, :external_branch_name).count
end
private
def sync_repository_params
params.permit(:type, :external_token, :external_repo_address, :sync_granularity, :external_branch_name, :gitlink_branch_name, :first_sync_direction)